Skip to content

How to mix stereo channels

L/R to M/S

Input/output data. See how to pass data to KFR

univector<float> left;
univector<float> right;
univector<float> middle;
univector<float> side;
Code
unpack(middle, side) = mixdown_stereo(left, right, matrix_halfsum_halfdiff());

  1. mixdown_stereo function takes arrays representing L and R channels and returns values multiplied by the given matrix.
  2. matrix_halfsum_halfdiff specifies that \((L+R)/2\) and \((L-R)/2\) must be returned
  3. unpack writes M+S values to the given arrays

M/S to L/R

Code

unpack(left, right) = mixdown_stereo(middle, side, matrix_sum_diff());
1. matrix_sum_diff specifies that \(M+S\) and \(M-S\) must be returned, effectively reverting back L and R channels

Downmix to mono

Input/output data.

univector<float> left;
univector<float> right;
univector<float> mono;
Code
mono = (left + right) * 0.5f;
or, depending on what results you want to get
mono = left + right;