Almost every playable synth patch ever shipped hides the same one-line formula: base + envelope × velocity × range. Learn it once and you can read any preset.
cutoff = const 400Hz + filtEnv * vel * 4000Hz — a floor the filter never drops below, an envelope that opens it on each note, velocity scaling how far.
The FILTER envelope's decay is a different knob from the AMP envelope's: it's the length of the bwow, not the note. A slow filter decay under a short amp decay is mush — the sweep outlives the sound.
Right now this patch's filter envelope decays over 500ms while the note is gone in 200 — tighten the filter decay below the amp decay and the pluck snaps into focus.
keytrack adds the last classic term: raise the cutoff as the notes go higher, so high notes don't choke. + keytrack (linear 0.6) ~C3 tracks the keyboard at 60%.
The starting point#
The lesson opens with this song in the editor. Every edit recompiles and plays.
-- The cutoff formula: this pluck's filter sweep ignores velocity and
-- outlives the note. Fix both.
pluck = patch {
source = saw (freq pitch),
ampEnv = adsr 2ms 200ms 0 120ms,
filtEnv = adsr 0ms 500ms 0 100ms,
cutoff = 400Hz + filtEnv * 4000Hz,
resonance = 5,
gain = vel * 0.5
}
line = play pluck !"c2=1 eb2=0.4 g2=0.8 [bb1=0.5 c2=0.5]"
What to watch#
Every note starts bright and darkens as the envelope falls — the spectrum's high end collapses within a beat. That fall IS the formula.
Goals#
The workbench checks these as you work; the solution is there when you want it.
- Velocity scales the sweep
- Snap the filter envelope — decay 200ms or less
- Stretch: track the keyboard
Make it yours#
Play the same pattern with the filter decay at 60ms, 150ms, and 400ms. Name what each one sounds like — then keep the one your bassline wants.
Further reading#
Filters: shape brightness and resonance in the reference.