An ADSR envelope shapes a parameter over four gate-driven stages: attack, decay, sustain, release
An ADSR envelope generates a control shape that governs how a parameter — usually amplitude, but equally filter cutoff or any target — evolves over the lifetime of a note, driven by a gate signal. Attack is the time to rise from zero to peak after the gate goes high (note-on). Decay is the time to fall from peak to the sustain level. Sustain is a level, not a time: the value held for as long as the gate stays high (a common misconception is that decay falls to zero rather than to the sustain level). Release is the time to fall back to zero after the gate goes low (note-off). Implemented in code it is naturally a finite state machine (idle → attack → decay → sustain → release): internal thresholds drive some transitions while the gate forces attack from any state and forces release on note-off; idle and sustain have no internal exit and move only on the gate. The gate need not come from a keyboard — an LFO or sequencer can drive it. Linear segments sound mechanical; exponential/curved segments better match perceived loudness and are used in most synthesizers.
Examples
Plucked string: fast attack, moderate decay, zero sustain, short release. String pad: slow attack, high sustain, long release. Piano: fast attack, fast decay, no sustain, longer release; an organ has fast attack and near-full sustain. Strudel: .adsr(.01, .2, .5, .3). SuperCollider: EnvGen.kr(Env.adsr(1.5, 1.5, 0.5, 4), gate: gate, doneAction: 2).
Assessment
Design ADSR settings for a plucked string, a slow pad, and a staccato stab, and say which parameter controls the pluck feel. Draw the state diagram, labelling what triggers each transition (what exits decay? what exits sustain? can idle go straight to decay?). Explain the difference between a sustain of 0% and 100%, what happens if the gate releases before decay finishes, and why exponential segments sound more natural than linear ones.