@maruaudio/dsp/stereo/width scales the side signal of a stereo pair through a mid/side matrix:
M = (L + R)/2 S = (L − R)/2
L' = M + w·S R' = M − w·SThe setter folds this into two coefficients, same = (1 + w)/2 and cross = (1 − w)/2, so each output channel is L × same + R × cross (or the mirror). Width 0 is mono, 1 is an exact identity and 1.5 is the widest image. It also exports f32 mid/side encode and decode functions.
Parameters
| Setter | Range the setter enforces | Default |
|---|---|---|
setStereoWidth | 0 to 1.5 | 1 (identity) |
midSideEncodeMid, midSideEncodeSide, midSideDecodeLeft and midSideDecodeRight take their samples as arguments and round to f32.
Lifecycle
initStereoWidthNode → setStereoWidth → stereoWidthLeft and stereoWidthRight per frame. There is no reset; the state holds only the width and its two coefficients. Sample operations allocate nothing and do no I/O.
When to use it
Narrowing a stereo source towards mono, widening it moderately, or converting to and from mid/side so another DSP node can process the two parts separately. The effects inventory lists the multi-effect's M/S Encoder slot against this DSP node.
Limits
- Stereo in, stereo out, one frame per call; the two channel functions read the same coefficients.
- The width operations are double multiplies with no rounding; the mid/side functions round to f32.
- Width changes apply at once, with no smoothing.
- The clamp is the kernel node's conditional clamp, not the
math/rangepolicy: a NaN passes through.