@maruaudio/dsp/dynamics/stereo-compressor adds detector profiles to the linked compressor of @maru/dynamics-stereo-linked. When its detector high-pass is active, each signed channel passes through its own RBJ high-pass (@maru/filters-biquad, Q 0.7071) before the max(|L|, |R|) link. RMS mode averages that one linked peak magnitude over the keyed compressor's fixed 10 ms mean-square window; it is not the larger of two RMS detectors. The knee is a fixed 6 dB and makeup is manual. The tick returns one gain for both channels.
const state = initStereoCompressor(48000)
configureStereoCompressor(state, -20, 3, 0.01, 0.15, STEREO_COMPRESSOR_DETECTOR_RMS, 120, 2)
const g = stereoCompressorGainTick(state, left, right)Parameters
| Setter | Range the code applies | Default | Unit |
|---|---|---|---|
setStereoCompressorParameters(state, threshold, ratio, attack, release) | −80 to 0 dB, 1 to 1000, 0 to 1 s, 0.001 to 10 s | −24 dB, 4, 0.01 s, 0.1 s | dB, ratio, s |
setStereoCompressorDetectorMode | ≥ 1 RMS, otherwise peak | Peak | mode |
setStereoCompressorDetectorHp | 20 to 2000; 20 is off | 20 (off) | Hz |
setStereoCompressorMakeup | −24 to +36 | 0 | dB |
configureStereoCompressor sets all of them without touching detector history.
Lifecycle
initStereoCompressor(sampleRate) → setters → stereoCompressorGainTick → resetStereoCompressor, which clears detector and reduction histories and keeps the controls. The high-pass recomputes coefficients only when its cutoff changes. Turning an active high-pass off clears its histories, so a later re-enable does not resume frozen state.
When to use it
Bus compression where low-frequency energy should not drive the gain, or where an averaged level suits the material better than peaks.
Limits
- Gain only, linked; no lookahead, auto-release, output mix or tail.
- With the high-pass off and peak mode, the tick is the linked compressor exactly. NaN and infinities are read as 0 before the detector filters.