Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@maruaudio/dsp/stereo/pan places one mono sample in a stereo pair with the equal-power law. The channel gains are @maru/mixing-levels' crossfade pair, cos(p·π/2) and sin(p·π/2) rounded to f32, so pan position 0.5 and crossfade position 0.5 mean the same gains. The setter resolves the gains; each channel output is a plain double multiply.

const state = initPanNode(48000) // centred
setPanNodePosition(state, 0.25)
const l = panNodeLeft(state, x)
const r = panNodeRight(state, x)

Parameters

SetterRange the setter enforcesDefault
setPanNodePosition0 (hard left) to 1 (hard right); 0.5 is centre0.5

Lifecycle

initPanNode → setPanNodePosition → panNodeLeft and panNodeRight per sample. There is no reset; the state holds only the two gains. The setter calls cos and sin; the sample operations allocate nothing and do no I/O.

When to use it

Positioning a mono source in a stereo mix with its power held constant across the field. For a bipolar −1 to 1 pan returned as unrounded doubles, use @maru/mixing-constant-power-pan; for a moving pan, use @maru/modulation-auto-panner.

Limits

  • Mono in, stereo out, one sample per call.
  • Hard right leaves the left gain at 6.12e-17, not an exact 0.
  • The sample outputs are not rounded to f32.
  • Position changes apply at once, with no smoothing.
  • The clamp is the kernel node's conditional clamp, not the math/range policy.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Position positionfloatsetPanNodePosition

Dependencies

Dependents

No other node imports this one.

Used by