Page 1 of 1

it's right way convert stereo to mono?

Posted: Tue Apr 07, 2015 2:00 pm
by Logado
I do not fully understand Mid / Side, this code works, but I'm not sure that is the right way.
Ideally I would decrease the level of component Side

dsp code:

Code: Select all

streamin inleft;
streamin inright;
streamin wide; // 1-0
streamout outleft;
streamout outright;
streamout outcenter;
outleft = inleft*wide;
outright = inright*wide;
outcenter = (inleft-outleft)+(inright-outright);

then
Image

Re: it's right way convert stereo to mono?

Posted: Tue Apr 07, 2015 2:57 pm
by KG_is_back
The way you can think of stereo wave is, that they record 2-dimensional movement of air at listeners head (or at stereo microphone, when recording). you can display it using stereoscope:
Image

mid coresponds to movement of air back and forth (along y-axis) and side coresponds to movement left and right (x-axis).
Left and right channels corespond to movement along 45degree angles.

to convert between LR and MS representations you may use following formulas:

Code: Select all

mid=(left+right)*0.5;
side=(left-right)*0.5;

left=mid+side;
right=mid-side;

the "0.5" coefficient is there to maintain proper gain-staging during conversion (the most correct way is to multiply by sqrt(0.5) during every conversion).
Mono file has no "side" element. What you are looking for is a stereo widening tool, which controls relative amplitude of mid and side elements. The most correct way would be to use this:

Code: Select all

streamin L;
streamin R;
streamin width; // 0=mono 0.5=original 1=side only
streamout Lout;
streamout Rout;
float mid;
float side;
mid=L+R;
side=L-R;
Lout=(1-width)*mid+width*side;
Rout=(1-width)*mid-width*side;

Re: it's right way convert stereo to mono?

Posted: Tue Apr 07, 2015 7:48 pm
by Logado
wow, thanks for the detailed answer KG