pausing and running groups

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pausing and running groups

spluta
Hi all,

I am trying to pause synths in a Group. I need a fade in and fade out simultaneously with the pause/run.

Thanks,

Sam

This first approach has always worked, not using groups.

//i have previously used this approach (without Groups)
(
a = {arg freq = 300, pauseGate=1; 
var pauseEnv;


pauseEnv = EnvGen.kr(Env.asr(0.05,1,0.1), pauseGate, doneAction:1);
SinOsc.ar(freq, 0, 0.1)*pauseEnv
}.play(s)
)

//run each line in order
a.set(\pauseGate, 0)
a.run(true)
a.set(\pauseGate, 1)


//changing the doneAction to 1, like above, which pauses the synth, does not work
//trying to figure out why
(
g = Group(s);

{arg freq = 300, pauseGate=1; 
var pauseEnv;

pauseEnv = EnvGen.kr(Env.asr(0.05,1,0.1), pauseGate, doneAction:1);
SinOsc.ar(freq, 0, 0.1)*pauseEnv
}.play(g)
)

//run each line in order
g.set(\pauseGate, 0)
g.run(true)
g.set(\pauseGate, 1)


//this approach using Groups does work:
(
g = Group(s);

{arg freq = 300, pauseGate=1; 
var pauseEnv;


pauseEnv = EnvGen.kr(Env.asr(0.05,1,0.1), pauseGate, doneAction:0);
SinOsc.ar(freq, 0, 0.1)*pauseEnv
}.play(g)
)

//run each line in order
g.set(\pauseGate, 0)
g.run(false)
g.run(true)
g.set(\pauseGate, 1)