Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Stereo utilities

Source of truth: the doc comments on each module struct in patches-modules/src/stereo/ define the canonical port names, parameter ranges, and behaviour. This page is kept in sync with those comments.

The stereo utility group covers image control — pan, balance, width, mid-side encode/decode, and a sum-mono-bass crossover. StereoSplitter, StereoJoiner, and StereoSum complement these but live elsewhere today; they will migrate into this group under the source-tree reorganisation tickets.

Pan — Equal-power mono pan

Places a mono signal in the stereo field using the equal-power law (L, R) = in · (cos θ, sin θ) with θ = (pan + 1) · π/4. The total power L² + R² is preserved across the sweep; at the centre each channel receives in / √2 (−3 dB). The CV input is added to the parameter and clamped to [-1, 1] before the angle is computed.

Parameters

ParameterTypeDefaultDescription
panfloat0.0Base position; -1 = L, +1 = R (-1–1)

Inputs

PortDescription
inMono source
panAdditive CV (offsets pan param)

Outputs

PortDescription
outEqual-power stereo L/R

Balance — Linear stereo balance

Attenuates one side of a stereo signal while the other passes unchanged. With balance ∈ [-1, 1], gain_L = clamp(1 − balance, 0, 1) and gain_R = clamp(1 + balance, 0, 1). At the centre the signal passes through unchanged; at the extremes the opposite side is silenced. The linear ramp per side matches the mixer’s pan-law ramp shape. The CV input is added to the parameter before clamping.

Parameters

ParameterTypeDefaultDescription
balancefloat0.0Base balance; -1 = L, +1 = R (-1–1)

Inputs

PortDescription
inStereo source
balanceAdditive CV (offsets balance param)

Outputs

PortDescription
outBalanced stereo

StereoWidth — Width control via internal M-S

Encodes the input to mid (M = (L+R)/2) and side (S = (L-R)/2), scales S by width, leaves M unchanged, and decodes back: L_out = M + width·S, R_out = M − width·S. At width = 0 both outputs collapse to the mono sum; at width = 1 the implementation short-circuits so the M-S round-trip is bit-exact; at width = 2 antiphase content is doubled. The CV input is added to the parameter and clamped to [0, 2] before scaling.

Parameters

ParameterTypeDefaultDescription
widthfloat1.00 = mono sum, 1 = unchanged, 2 = double-wide (0–2)

Inputs

PortDescription
inStereo source
widthAdditive CV (offsets width param)

Outputs

PortDescription
outWidth-scaled stereo

MidSide — Bidirectional encode/decode

Two independent arithmetic paths in one module: the encode side reads stereo_in (L/R) and writes (M, S) = ((L+R)/2, (L-R)/2) to ms_out; the decode side reads ms_in (M/S) and writes (M+S, M−S) to stereo_out. Either side can be used in isolation by leaving the other side’s ports unconnected.

All four ports are stereo cables. The mid-side form is just a stereo cable carrying (M, S) rather than (L, R) — nothing in the descriptor distinguishes the two, the same constraint that already applies to any mid/side workflow in a DAW.

Inputs

PortDescription
stereo_inL/R input to encode side
ms_in(M, S) input to decode side

Outputs

PortDescription
ms_out(M, S) from encode side
stereo_outL/R from decode side

MonoBass — Mono-summed bass via LR4 crossover

Splits the stereo input into a low band and a high band at cutoff using Linkwitz-Riley 4th-order filters (two cascaded Butterworth biquads each). The lows are summed to mono ((L+R)/2 then LP-filtered) and sent identically to both output channels; the highs are HP-filtered per channel so the stereo image above the crossover is preserved. At the crossover frequency, the LP and HP magnitudes are each −6 dB; the sum-flat property means an L = R input is reconstructed at unity magnitude while differential content below the cutoff is summed away.

Use for vinyl-safe masters, club-system protection, and any source whose low end you don’t trust to be summable.

Parameters

ParameterTypeDefaultDescription
cutofffloat Hz120.0Crossover frequency (20–2000 Hz)

Inputs

PortDescription
inStereo source

Outputs

PortDescription
outHigh-band stereo + low-band mono on both