Skip to main content

panning

Function panning 

Source
pub fn panning(left: &[f32], right: &[f32]) -> Result<f32, AudioError>
Expand description

Panning coefficient of a stereo pair from its channel energy balance.

left and right are matching-length slices — either time-domain samples or magnitude-spectrum bins of the two channels. With E_L = Σ left[i]^2 and E_R = Σ right[i]^2, the coefficient is

pan = (E_R - E_L) / (E_R + E_L)

It lies in [-1, 1]: -1 = hard left, 0 = centred (equal energy), +1 = hard right.

Zero-heap: single pass, scalar result.

§Errors