Hello everyone!
Is it possible to fade in and out the synths generated from a Pdef ?
I know that I could use proxy space or Ndefs for that, but I have a long setup code and a close performance, I think I won’t have the time to rewrite my code and I’m not so confident with using proxyspace.
Here is a simple example.
(
SynthDef(\synth, {
arg freq = 220, amp = 0.2, gate = 1;
var sig, env;
sig = LPF.ar(Saw.ar(freq), freq * 3);
env = Env.perc().ar( 2, gate);
sig = sig * env * amp;
sig = Pan2.ar(sig, 0);
Out.ar(0, sig)
}).add;
Pdef(\seq, Pbind(
\instrument, \synth,
\dur, 0.125,
\degree, Pwhite(0, 12, inf),
\amp, Pwhite(0.1, 0.2, inf) * Pdefn(\fade)
));
)
~seq = Pdef(\seq).play; // let the pattern play for a while
Pdefn(\fade, Pseg([1,0], 4, -4)); //fade out with Pseg
My solution for now is to use Pdefn in the amp arg, and fade out using Pseg when I want to stop the sequence.
The problem is that when I start the pattern again with the play message, Pdefn(\fade) is still burned into the Pattern and I got an immediate fade out, which is not what I need.
Is there a built in way to let the pattern do its job for a while and then fading it out with a stop messagge?
Thank you in advance
best,