home/ atoms/ sc-adsr-gate

Sustained (ADSR/ASR) envelopes require a gate argument: gate=1 opens the envelope, gate=0 triggers release

Fixed-duration envelopes (Env.perc, Env.triangle) have a known total time. Sustained envelopes (Env.adsr, Env.asr) do not — they hold at the sustain level until a gate message signals release. The synth must declare a gate argument (default gate=1 so it starts immediately). Sending synth.set(\gate, 0) or synth.release triggers the release stage. After release completes, doneAction:2 frees the synth. The four ADSR parameters: attackTime (silence to peak), decayTime (peak to sustain amplitude), sustainLevel (fraction 0–1), releaseTime (sustain to silence).

Examples

x = {arg gate=1,freq=440; SinOsc.ar(freq)*Env.adsr(0.01,0.4,0.7,2).kr(2,gate)}.play; x.set(\gate,0); // or x.release

Assessment

Build a simple ADSR synth with gate control. Trigger it on and hold for 3 seconds, then release. Verify it frees itself.

“the envelope must hold the note for an indefinite amount of time, and only trigger the release portion after some kind of cue, or message”
corpus · a-gentle-introduction-to-supercollider-ruviaro-archive-org-c · chunk 15