Confused by Done Ugen

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?


Ndef(\test, {
	var trig0 = 1;
	var env0 = Env([1, 2], [2], -4).kr(gate:trig0);
	var trig1 =;
	var env1 = Env([3, 4], [2], -4).kr(gate:trig1);
	var trig2 =;
	var env2 = Env([5, 6], [2], -4).kr(gate:trig2);

It’s working here.

Which version? Maybe you’re seeing an old bug that was fixed?


SC version 3.10.3
Mac OSX 10.14.5 Mojave

Ok, that’s recent.

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


That’s definitely a bug.

But it might be fixed in the development branch. The EnvGen c++ sources include the following in the development branch, but it’s not in 3.10.

I’ve been using the development branch, which might explain why my result is different.

Maybe try a “bleeding edge” build.


it seems to be fine in the bleeding edge build. thanks

Last update: 3.10.4 just came out, a day or two before this thread. So it isn’t fixed in that release.

There won’t be another 3.10.x release (I was just told).

So it’ll be fixed in 3.11 (the fix is already merged in).


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 ={|m, t| "reply!".postln }, '/reply', Server.default.addr);\foo, { 
        var sig, env;

        env =, \;
        sig = * env;, '/reply', [0]);, sig)

…and then creating an instance of the Synth:

x =\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.