Sound has to start and stop. An envelope shapes loudness over time — pluck vs pad, and the 303's per-note "blip".
The VCA. Last lesson the note snapped on and off — that click is because we jumped the
volume instantly. Real instruments swell and fade. In synth terms, the oscillator runs continuously
and its loudness is shaped by a Voltage-Controlled Amplifier — which in Web Audio is just a
GainNode whose gain we automate over time. That automation curve is the
envelope.
A·D·S·R — the four numbers that describe almost any envelope. Move the sliders and watch the left graph; press & hold play and watch the dot travel it:
| stage | what it is | ear |
|---|---|---|
| Attack | time to rise from silence to full level after you hit the note | 0 = instant/percussive · long = a slow swell |
| Decay | time to fall from full down to the sustain level | the initial "thump" before it settles |
| Sustain | the level it holds at while you keep the note down (not a time!) | 0 = plucky · high = an organ that just holds |
| Release | time to fade to silence after you let go | 0 = abrupt · long = a lingering tail |
Why this matters for acid. Try the 303 blip preset: instant attack, zero sustain, short decay. Every note is a short percussive blip — that's literally the 303's amp envelope. So where does all the movement in an acid line come from, if the volume just blips? A second envelope, identical in shape, aimed at the filter instead of the volume. That's Module 1–2, and it's the whole game. This lesson is you learning the tool; next you learn what it opens (the filter), then we point an envelope at it.
CS note: we build the curve with AudioParam
automation — setValueAtTime to pin "now", then linearRampToValueAtTime for each
leg. On note-off we cancelScheduledValues and ramp to 0. Ramping (never jumping) is what
kills the click. The dot's height is read straight from the live gain.value, so what
you see is exactly what the amplifier is doing.