@maruaudio/dsp/dynamics/sidechain-duck is the CHOMPI TEMPO firmware's SimpleCompressor: a key signal lowers the gain of a second stereo signal. The key is the mean of its two channels boosted ×100 and rectified; a one-pole envelope (the attack coefficient) follows it, clamped to 1. Above a threshold of 0.1 the target gain falls linearly to 1 − amount at a full-scale envelope. The gain is smoothed with the attack coefficient while falling and the release coefficient while rising. Every operation is rounded to f32 in firmware order.
const state = initSidechainDuckNode()
setSidechainDuckAmount(state, 0.6)
sidechainDuckTick(state, wetL, wetR, dryL, dryR) // state.outLeft, state.outRightParameters
| Setter | Range as coded | Default | Unit |
|---|---|---|---|
setSidechainDuckAmount | Rounded to f32, not clamped; the source documents 0 to 1 | 0 | duck depth |
Attack and release are constants, 1 − exp(−1/(t·48000)) for t = 10 ms and 250 ms, computed once at init.
Lifecycle
initSidechainDuckNode() (amount 0, envelope 0, gain 1) → setSidechainDuckAmount → sidechainDuckTick(state, inL, inR, keyL, keyR) per frame → resetSidechainDuckNode, which restores amount, envelope, gain and outputs to their init values. The coefficients do not change.
When to use it
Pulling a delay or reverb return down while the dry signal plays and letting it swell back in the gaps, as TEMPO does with its feedback knob as the amount.
Limits
- Stereo in, one stereo key, stereo out; one gain for both channels.
- The 48 kHz rate is hard-coded, as upstream, so the times scale at other rates.
- Reset also zeroes the amount; set it again after a reset.