Build with this node

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

Ask Studio

@maruaudio/dsp/dynamics/stereo-expander is a linked downward expander on the finite max(|L|, |R|) peak of @maru/dynamics-stereo-linked (−240 dB floor). Below the threshold it attenuates by (threshold − level)·(ratio − 1) dB, joined to unity by a quadratic knee with continuous value and slope. The linear gain is smoothed by a branching one-pole (attack opens, release closes), rounded to f32, and returned for the caller to apply to both channels.

const state = initStereoExpander(48000)
setStereoExpanderRatio(state, 3)
const g = stereoExpanderGainTick(state, left, right)

Parameters

Each setter replaces a non-finite value with the fallback shown, then clamps.

SetterRange the setter enforcesDefault (fallback)Unit
setStereoExpanderThreshold−80 to 0−40 (−40)dB
setStereoExpanderRatio1 to 20; 1 is exact unity2 (1)ratio
setStereoExpanderKnee0 to 72 (full width)6 (0)dB
setStereoExpanderAttack0 to 1; governs opening0.01 (0.01)s
setStereoExpanderRelease0.001 to 10; governs closing0.1 (0.1)s

setStereoExpanderParameters sets four at once; downwardExpansionReductionDb is the static curve.

Lifecycle

initStereoExpander(sampleRate) (rate bounded to 8 to 384 kHz, NaN gives 48 kHz) → setters → stereoExpanderGainTick → resetStereoExpander, which returns the gain to unity and keeps controls and coefficients. There is no prepare step.

When to use it

Lowering room noise, bleed or tails between phrases on a stereo source, in proportion to how far below the threshold they fall.

Limits

  • Gain only, linked. No hysteresis, range floor, hold, detector filter, mix, lookahead or latency. One attack time from silence reaches about 63 %.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Stereo expander threshold stereoExpanderThresholdfloatsetStereoExpanderThreshold
Stereo expander ratio stereoExpanderRatiofloatsetStereoExpanderRatio
Stereo expander knee stereoExpanderKneefloatsetStereoExpanderKnee
Stereo expander attack stereoExpanderAttack

Attack governs gain opening; release governs attenuation as the detector falls.

floatsetStereoExpanderAttack
Stereo expander release stereoExpanderReleasefloatsetStereoExpanderRelease

Dependencies

Dependents

Used by