Skip to content

Panner

Tier: Primitives | ComponentType: 9 | Params: 2

Equal-power and linear pan law for mono-to-stereo distribution.

Overview

Panner distributes a mono input signal across left and right channels using either equal-power or linear pan law. Equal power (default) uses cosine/sine curves to maintain perceived loudness at the center position (-3 dB per channel). Linear panning uses simple gain ratios (-6 dB at center).

The pan position ranges from -1.0 (hard left) through 0.0 (center) to +1.0 (hard right). Output is a StereoFrame with separate left and right gains applied to the input.

File Locations

Path
Header Sources/FolioDSP/include/FolioDSP/Primitives/Panner.h
Implementation Sources/FolioDSP/src/Primitives/Panner.cpp
Tests Tests/FolioDSPTests/PannerTests.swift
Bridge Sources/FolioDSPBridge/src/FolioDSPBridge.mm (PannerBridge)

Parameters

Index Name Description Min Max Default Min Default Max Default Unit
0 Pan Pan position: -1=left, 0=center, +1=right -1.0 1.0 -1.0 1.0 0.0
1 Law Pan law: 0=equal power, 1=linear 0.0 1.0 0.0 1.0 0.0

Processing Algorithm

Equal Power (law < 0.5)

\[\theta = \frac{\pi}{4}(1 + p)\]
\[L = \cos(\theta) \cdot x, \quad R = \sin(\theta) \cdot x\]

Power is preserved: \(\cos^2\theta + \sin^2\theta = 1\).

Linear (law >= 0.5)

\[L = \frac{1 - p}{2} \cdot x, \quad R = \frac{1 + p}{2} \cdot x\]

Snapshot Fields

Field Type Range Unit Description
Pan Float -1–1 Current pan position
Gain L Float 0–1 Left channel gain
Gain R Float 0–1 Right channel gain

Implementation Notes

  • Equal power maintains perceived loudness at center (-3 dB per channel)
  • Linear gives -6 dB at center but sounds more natural for some applications
  • Pan parameter is smoothed; law switching may cause a small discontinuity
  • Mono input, stereo output (StereoFrame)

Equation Summary

L = cos(pi(1+p)/4); R = sin(pi(1+p)/4)