@audio/synth-envelope
v1.1.3
Published
ADSR envelope generator — gain contour for amplitude/filter modulation
Readme
@audio/synth-envelope

ADSR contour generator (one-shot, known length)
npm install @audio/synth-envelopeimport adsr from '@audio/synth-envelope'ADSR gain-contour generator — attack/decay linear, sustain flat, release exponential-ish. Returns a Float32Array contour to multiply onto any source (gain, filter cutoff, amplitude); one-shot, whole envelope rendered up front (known total length, unlike a gate-driven realtime ADSR).
adsr({ attack: 0.01, decay: 0.1, sustain: 0.7, release: 0.3, duration: 1 })| Param | Default | |
|---|---|---|
| attack | 0.01 | Seconds |
| decay | 0.1 | Seconds |
| sustain | 0.7 | Sustain level, 0..1 |
| release | 0.3 | Seconds |
| duration | 1 | Note-on length, seconds (release starts here) |
| fs | 44100 | Sample rate |
Use when: shaping any generator's amplitude or a filter cutoff — used internally by synth-voice.
Part of @audio/synth — the synth family umbrella.
MIT © audiojs
