ADSR

Generate attack-decay-sustain-release envelope curves.

What it does

ADSR watches a trigger signal for a threshold crossing and turns each crossing into a shaped envelope: a ramp to a peak (Attack), a fall to a held level (Decay and Sustain), then a fade to zero once the trigger drops (Release). The classic synthesiser envelope, driving any animatable parameter.

A Number or Boolean input gives one envelope. A Number Array gives one independent envelope per element, such as a particle system's per-point triggers. Each stage's shape bends from linear toward ease-in or ease-out, and an audio-rate buffer is available instead of one value per frame.

When to use it

ParameterTypeDefault
triggerOneOf([Number, Boolean, NumberArray, Vec3, Color])
resetOneOf([Boolean, Number])
thresholdNumber0.500
edgeString"Rising"
retriggerString"Restart"
attackNumber0.050
peakNumber1
decayNumber0.300
sustainNumber0
releaseNumber0.100
attack_curveNumber0
decay_curveNumber0
release_curveNumber0
sample_rateNumber0

Gotchas

Retrigger controls what happens if the trigger fires again before the envelope has finished. Restart snaps back to Attack. Max layers a new envelope in and keeps the louder of the two. Ignore drops new triggers until the current one goes idle. Add stacks envelopes on top of each other.

Scrubbing the timeline backward resets the envelope's trigger count and phase state. Expect a jump in count and a fresh Attack the next time you land on a rising edge, rather than a continuation.

The envelope output, an audio-rate buffer, only fills once Sample Rate is above 0. At Sample Rate 0 you get value and normalized per frame instead, and envelope stays empty.

A Number Array wired into Trigger drives many envelopes from one node. Each element gets its own Attack, Decay, Sustain, and Release state, and value and normalized come back as matching arrays.

Worked example

  1. Add an ADSR. Wire a Number or Boolean signal into Trigger. Anything that crosses your Threshold fires the envelope.

  2. Set Attack, Decay, Sustain, and Release to shape the hit: short Attack and Decay with Sustain at 0 gives a quick percussive pop.

  3. Bend Attack Curve or Release Curve toward -1 or 1 if linear feels too mechanical.

  4. Take value (or normalized for a 0-1 range) into the parameter you want to animate: scale, opacity, light intensity.

  5. For faster than per-frame, raise Sample Rate and read the envelope output instead.

See also

Oscillate · State Machine · Delay · Numbers, signals & audio