@maruaudio/dsp/dynamics/stereo-transient-shaper ports Gin's full-band TransientShaper (after MGA TranShaper). A mid/side detector max(|M·wM|, |S·wS|) + 1e−5 feeds one-pole amplitude envelopes at 10, 100 and 1 Hz, each read through a square root. The gain (att/env)^attack · (rel/env)^sustain (ratios at least 1) is smoothed, capped at the target and at 64, and applied to mid and side with the processing balance as exponents. All arithmetic is f32.
Parameters
Each setter replaces a non-finite value with the default, clamps and rounds to f32.
| Setter | Range the setter enforces | Default | Unit |
|---|---|---|---|
setStereoTransientShaperAttack | −4 to 4; positive sharpens attacks | 0 | exponent |
setStereoTransientShaperSustain | −8 to 8; positive lengthens sustain | 0 | exponent |
…DetectorBalance / …ProcessBalance | 0 (mid) to 1 (side); 0.5 both | 0.5 / 0.5 | balance |
setStereoTransientShaperSmoothing | 0 (10 kHz) to 1 (0.1 Hz) gain smoother | 0.5 | normalized |
setStereoTransientShaperOutputDb | −60 to +24 | 0 | dB |
Lifecycle
initStereoTransientShaper(sampleRate) (8 to 384 kHz, NaN gives 48 kHz) → setters → stereoTransientShaperTick(state, left, right) → resetStereoTransientShaper, which clears envelopes, gain and outputs and keeps the controls. The gain starts at zero after init and reset, as in Gin, so audio ramps in through the smoother. There is no prepare step.
When to use it
Bringing the hit of a drum loop forward or pushing it back, or shortening and lengthening room tails, on a stereo source without a threshold to set.
Limits
- Stereo, no lookahead or latency; Gin's optional band split is not included.
- Each lane is bounded to ±1,000,000 (non-finite read as 0). The 1e−5 detector floor matters at very quiet levels.