I wanted to sequence three envelopes. In the snippet below, env0 should start immediately. When it is done it should trigger env1. When env1 is done it should trigger env2. The Done trigger for env1 seems to work as expected but the Done trigger for env2 seems to fire immediately - not waiting for env1 to finish. Am I misunderstanding how Done is supposed to work?
Thanks,
(
Ndef(\test, {
var trig0 = 1;
var env0 = Env([1, 2], [2], -4).kr(gate:trig0);
var trig1 = Done.kr(env0);
var env1 = Env([3, 4], [2], -4).kr(gate:trig1);
var trig2 = Done.kr(env1);
var env2 = Env([5, 6], [2], -4).kr(gate:trig2);
env2.poll;
Silent.ar(2);
})
)
I’m not sure what the issue is, then. I tried your code and found that env2 starts at its initial level 5, and 4 seconds later, rises to 6. In my test, it definitely held 5 and did not rise immediately.
We have occasionally seen c++ compilation issues where some UGens behave differently on different platforms. Right now all we know is that there’s some strange result for you on Mac, and expected behavior for me in Linux. I think we need more people to test, to be more sure where the bug does and doesn’t occur.
just did a quick test here on Mac OS 10.14.6 with SC 3.10.2
and when polling I consistently got starts at:
//env0 UGen(EnvGen): 1.00295
//env1 UGen(EnvGen): 3
//env2 UGen(EnvGen): 5.00295
Just wanted to mention that I’m still seeing this issue as well – SC 3.11.0 / MacOS 10.14.6.
In the example upthread, I’ve got env2 being triggered immediately.
A related example: evaluating the following:
(
o = OSCFunc.new({|m, t| "reply!".postln }, '/reply', Server.default.addr);
SynthDef.new(\foo, {
var sig, env;
env = EnvGen.kr(Env.adsr, \gate.kr(0));
sig = SinOsc.ar * env;
SendReply.kr(Done.kr(env), '/reply', [0]);
Out.ar(0, sig)
}).add
)
…and then creating an instance of the Synth:
x = Synth.new(\foo)
…triggers the OSCFunc immediately, before \gate has been set high.
Please let me know if it would be helpful for me to open or comment on a GitHub issue – I had a quick look and it seems as though there’s been quite a lot of discussion around EnvGen and Done over the years, so I’m not sure where’s the best place to jump in.