Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@maruaudio/dsp/envelopes/overshoot-adsr is DaisySP's Adsr with its exact f32 semantics, as the CHOMPI firmware's sample voices use it. Each stage is a one-pole step toward a target past its end point: attack aims at 9·shape¹⁰ + 0.3·shape + 1.01 and ends on crossing 1; decay chases the sustain level; release aims at −0.01 and goes idle on crossing 0. Decay and release coefficients are 1 − exp(ln(1/e) / (t·rate)), so a stage covers 1 − 1/e of its distance in t seconds; the attack coefficient uses its own target.

const env = initOvershootAdsrNode(48000)
setOvershootAdsrAttack(env, 0.005, 0)
const level = overshootAdsrNodeTick(env, gateHigh) // per sample

Parameters

Inputs are rounded to f32. Times and shape are cached: a setter with unchanged values leaves the coefficient alone. A non-positive time gives an instant stage.

SetterRange as codedDefaultUnit
setOvershootAdsrAttack(state, time, shape)Not clamped; shape sets the overshoot target0.1, shape 0s, curve
setOvershootAdsrDecay / …ReleaseNot clamped0.1 / 0.1s
setOvershootAdsrSustainAbove 1 becomes 1; at or below 0 becomes −0.01, which sends decay to idle0.7level

Lifecycle

initOvershootAdsrNode(sampleRate, blockSize = 1) stores the integer rate int(sampleRate / blockSize) and sets 0.1 s stages → setters → overshootAdsrNodeTick(state, gate) per sample: a rising gate starts the attack from the current level, a falling gate the release. retriggerOvershootAdsr(state, hard) enters attack, from zero when hard. resetOvershootAdsrNode idles at zero with the gate low, keeping the settings.

When to use it

Reproducing the firmware's sample-voice envelope exactly, or a gate envelope whose attack overshoot is set by one shape control.

Limits

  • One branch and one f32 step per sample; exp, log and pow run only in setters. The rate is an integer, as upstream; the firmware's expf and logf may differ by one f32 ulp for rare arguments.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Overshoot adsr decay overshootAdsrDecay

`SetDecayTime`.

floatsetOvershootAdsrDecay
Overshoot adsr release overshootAdsrRelease

`SetReleaseTime`.

floatsetOvershootAdsrRelease
Level level

`SetSustainLevel`: <= 0 becomes -0.01 (decay ends idle); > 1 becomes 1.

floatsetOvershootAdsrSustain

Dependencies

None: this node imports no other node.

Dependents

No other node imports this one.

Used by