ADSR envelopes require a gate argument; trigger arguments cause immediate release on ADSR
Env.adsr (attack-decay-sustain-release) differs from fixed-length envelopes in that it sustains indefinitely as long as gate remains positive. Setting gate to 0 triggers the release phase. This requires a normal (non-trigger) argument: if you use a t_gate (trigger argument) with ADSR, the gate automatically falls to zero within one control cycle, immediately triggering release — making sustained sound impossible. Use normal gate arguments for sustaining envelopes; use t_gate arguments for one-shot envelopes that should be re-triggerable.
Examples
x = { arg gate=0; var sig, env; env = EnvGen.kr(Env.adsr, gate, doneAction:2); sig = LFTri.ar(440) * env; Out.ar(0, sig!2); }.play;
x.set(\gate, 1); // sustain
x.set(\gate, 0); // release
Assessment
A student uses t_gate with Env.adsr and complains the note never sustains. Explain why, and show the fix.