[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] Loosing attack when re-triggering custom envelopes



Hello Sc Users,

In a trial to build a simple drum synth, I am optimizing by re-triggering enveloppes instead of creating new Synth instances each time I got an event (MIDI / OSC) for a drum.

Here is an example of a Kick drum.
I have a strange issue that I encountered by using Env.new instead of Env.perc.
Re-triggering an EnvGen which has been created using Env.new instead Env.perc has only once the attack power at synth creation and loose it after while re-triggering.

SynthDef(\nun_kick_b,{
	arg out=0, amp=0.6, pan=0, t_trig = 1;
	var env0, env1, env1m, son;

	env0 =  EnvGen.ar(Env.new([0.5, 1, 0.5, 0], [0.005, 0.06, 0.26], [-4, -2, -4]), t_trig);
	env1 = EnvGen.ar(Env.new([110, 59, 29], [0.005, 0.29], [-4, -5]), t_trig);
	env1m = env1.midicps;
	son = LFPulse.ar(env1m, 0, 0.5, 1, -0.5);
	son = son + WhiteNoise.ar(1);
	son = LPF.ar(son, env1m*1.5, env0);
	son = son + SinOsc.ar(env1m, 0.5, env0);

	son = son * 1.2;
	son = son.clip2(1);

	Out.ar(out, Pan2.ar(son * amp));

}).add;

x = Synth("nun_kick_b"); // perfect click at the beginning

x.set(\t_trig,1); // attack is less powerful I dont know why !


Any clue on that ?

Thanks!


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/