← Acid Lab

01 · Gain & envelopes — the VCA

Sound has to start and stop. An envelope shapes loudness over time — pluck vs pad, and the 303's per-note "blip".

Envelope · level over time (A·D·S·R)

Oscilloscope · what you hear

presets:

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:

stagewhat it isear
Attacktime to rise from silence to full level after you hit the note0 = instant/percussive · long = a slow swell
Decaytime to fall from full down to the sustain levelthe initial "thump" before it settles
Sustainthe level it holds at while you keep the note down (not a time!)0 = plucky · high = an organ that just holds
Releasetime to fade to silence after you let go0 = 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.