Build with this node

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

Ask Studio

@maruaudio/dsp/stereo/to-mono downmixes one stereo frame to mono with the Web Audio speakers rule for two channels to one: the arithmetic mean (left + right) × 0.5, rounded to f32. It is a named DSP node so a planner can route a stereo source into a mono chain explicitly rather than picking one channel.

const mono = stereoToMonoNodeTick(left, right)

Parameters

There are no setters or state. Both samples are arguments to stereoToMonoNodeTick.

Lifecycle

A stateless sample operation: no init, prepare or reset. It allocates nothing and does no I/O.

When to use it

Feeding a stereo signal into a mono effect or analyser the way a browser GainNode with channelInterpretation="speakers" would. Ping-Pong Delay's public graph downmixes its stereo input this way before seeding the delay.

Limits

  • Stereo in, mono out, one frame per call.
  • Fully out-of-phase content cancels: (1, −1) gives 0.
  • The result is rounded to f32, so it can differ from the double mean.

Algorithm properties and proofs

Lean 4 checks specific properties of this algorithm’s mathematical model. Each model result applies within its stated domain and assumptions.

1 Lean 4 result: 1 proof in exact arithmetic.

Proved in exact arithmetic.The stereo arithmetic mean stays inside the common interval of its input channels.Exact rationals; ordered finite bounds and stated coefficient guards
Limits and assumptions
  • Hand-written source-reviewed model, not formal refinement of TypeScript or compiled code. Named functions and whole-file source digests are checked; finite canonical JavaScript cases are compared with executable Lean definitions. Exact rational arithmetic only: IEEE rounding, overflow, NaN, infinities and signed-zero behavior are not proved. Sampler mappings cover the named shared stage only. No optimization is enabled or claimed faster.
Theorem
MaruLean.LeafContracts.mono_bounded
Recorded axioms
propext, Classical.choice, Quot.sound
Manifest reviewed
Explore proofs alongside performance

Dependencies

None: this node imports no other node.

Dependents

No other node imports this one.

Used by