I have been working with long, arbitrary Envelopes, generated via Env.new.
I would like them to play out, as long as they are receiving a gate - but I would like them to fade out when the gate is released, regardless of what point they are currently at.
Is there a type of Env that can do this? Maybe a suggestion of an approach?
I have been working with long, arbitrary Envelopes, generated via Env.new.
I would like them to play out, as long as they are receiving a gate
You mean gate open value, right?
but I would like them to fade out when the gate is released, regardless of what point they are currently at.
Not sure this is elegant enough, just from the top of my head, using any envelope and another gate to suspend this below:
x = {SinOsc.ar(220.0, 0.0, EnvGen.kr(Env.perc(releaseTime: 2.0), doneAction: 0)) * EnvGate(1, \gate.kr(1), \fdTime.kr(2.3), doneAction: 0)};
y = x.play;
y.set(\gate, 0, \fdTime, 0.05); //this will override the `Env.per` parameters once the gate argument is 0.