The truth behind stereo spreading.

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

braindoc wrote:
janesconference wrote:One more question: if I wanted to play only the "mono" part (ie the signal minus the S part), say at 200% width
mmhh?! mono and 200% width are mutually exclusive in my book. mono is synonymous to 0% width.
Ok, let's say I play 200% width: I hear the synth + the voice and no drumkick (depends on the song, but let's say so). Let's call the signal I hear S.

If I wanted to hear only the drumkick, and no voice + synth (or, at least, the parts of voice and synth I can hear on S), I would subtract S from the original signal (that contains S).

But, algorithmically, it seems it doesn't work.

Or are you suggesting that if I want no S, I should set the width to 0% ?

Because I tried, and this only makes the L and R channels equal (and I still clearly hear the voice and synth).
Creator of Hya.io - https://hya.io

Post

janesconference wrote: Or are you suggesting that if I want no S, I should set the width to 0% ?
yep. 0% means, you multiply S by a factor of zero in the middle part - so, no S will be left in your final output.
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

I'm confused over the sqrt(2) still.

Is this actually necessary?

Post

OK I found this thread

http://www.uneeda-audio.com/ms-mat.htm

that says
If M = mono = L + R
and
S= difference = L - R
then by adding and subtracting the M and S signals
M + S = (L+R) + (L-R) = 2L
M - S = (L+R) - (L-R) = L + R - L + R = 2R
if I factor in the sqrt(2) from braindocs post

M = (L+R) / sqrt(2)
S = (L-R) / sqrt(2)

then

M+S = 2*L/sqrt(2)
M-S = 2*R/sqrt(2)

L = (M+S)*sqrt(2)/2
R = (M-S)*sqrt(2)/2

is that right?

Post

braindoc wrote:
janesconference wrote: Or are you suggesting that if I want no S, I should set the width to 0% ?
yep. 0% means, you multiply S by a factor of zero in the middle part - so, no S will be left in your final output.
I understand. So, maybe, a lot of signal is lost when I decide to turn 200% and listen only to the S part (i lose the drumkick almost completely), but a lot of signal is preserved when I turn 0% to listen only to the M part (I still can hear clearly voice and istruments - seems they have a lot of M component).
Creator of Hya.io - https://hya.io

Post

de la Mancha wrote:I'm confused over the sqrt(2) still.

Is this actually necessary?
no. it's only there for better "pan law" behaviour when you move the knob.

I personally don't bother with such as it's a waste of CPU time and can better be implemented "UI side" or as a wrapper (and only when absolutely required) for any particular parameter.

Post

de la Mancha wrote:OK I found this thread

http://www.uneeda-audio.com/ms-mat.htm

that says
If M = mono = L + R
and
S= difference = L - R
then by adding and subtracting the M and S signals
M + S = (L+R) + (L-R) = 2L
M - S = (L+R) - (L-R) = L + R - L + R = 2R
O.K. i just consulted some pen and paper and obtained the same result: when leaving out the normalization by 1/sqrt(2), the reconstructed L and R signals will have twice the amplitude. that's cool, because the multiplication by 2 in the middle part can be left out then (as i suspected). so the refined (and simplified) algorithm would be:

Code: Select all

M = L+R;
S = L-R;

M *= (1-width);
S *= width;

L = M+S;
R = M-S;
the normalization for the intermediate signals can be optimized away, as long as we do not want use the M and S signal directly (and thereby insist on M and S to have equal power as both channel signals under the assumption of uncorrelated channels)
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

HunterKiller wrote:That's not really the truth, because it doesn't apply to many hard panned tracks. You can clearly hear the bass being panned across two stereo speakers, whereas the same song sounds very different on 5.1 and 7.1 systems, which only contain one speaker capable of reproducing bass content. And when I say very different, the bass - 100% of the time sounds less powerful, not to mention less directional, than in a 2 speaker setup. So when right in front of you, you can hear the bass and where it's coming from.
You're not taking into account that a properly set up subwoofer has the frequency crossover set low enough to avoid directionality yet high enough to work seamlessly with the other speakers. It's impossible to locate the source of true low bass. Upper bass and harmonics do have directional qualities -- that's what you're hearing.
We escape the trap of our own subjectivity by
perceiving neither black nor white but shades of grey

Post

braindoc wrote:so the refined (and simplified) algorithm would be:

M = L+R;
S = L-R;

M *= (1-width);
S *= width;

L = M+S;
R = M-S;
And, if i did my calculation right:

Lnew = L + (1 - 2 * width) * R
Rnew = R + (1 - 2 * width) * L
Creator of Hya.io - https://hya.io

Post

thanks all for your help in this thread, it's someting I struggled to get my head round, but now I think I got it

Post

Wait, one last thing: when width = 0 (mono), according to the formulas, Rnew = Lnew = L + R.

Each of L & R channels is equal to the sum of stereo L and R? Isn't it too much?
Creator of Hya.io - https://hya.io

Post

janesconference wrote:Wait, one last thing: when width = 0 (mono), according to the formulas, Rnew = Lnew = L + R.

Each of L & R channels is equal to the sum of stereo L and R? Isn't it too much?
damn, true. seems we must divide that by sqrt(2). :bang: oh, well. i have to think it over. ...but not now.

edit: ahh, wait: the linear crossfade-rule may be wrong: i think, we should better use constant power (sin/cos) crossfade-rule here. i'm a bit in a hurry now, but tomorrow will look up what i did in my MidSideMixer and come back.
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Kingston wrote:Below certain (low) frequency (which I'm too lazy to google up) you don't have directionality. you can test it easily with steep lowpass filters, but even in that case you have to take into account room resonances (ie. rattling furniture), which can in certain cases give a sense of direction.
If you wanted to test that the lack of directionality of bass frequencies is a physical phenomenon rather than a perceptual / cognitive phenomenon, you would have to use some sort of device that can echolocate sounds. The military has such a device for locating the direction of sniper fire, but even something like that may have frequency limitations that wouldn't give you the whole picture.

My strong suspicion is that low sounds with long wavelengths are physically less directional in small rooms, but are more directional in large rooms. However, the human ear is also probably less attuned to being able to find the source of low sounds, so perception likely plays a role regardless of room size.

Tom
Image

Post

O.K. here are the relevant parts of the code of my MidSideMixer plugin:

Code: Select all

void MidSideMixer::setMidSideRatio(double newRatio)
{
 midGain  = sqrt(2.0) * cos(0.5*PI*newRatio);
 sideGain = sqrt(2.0) * sin(0.5*PI*newRatio);
}

INLINE void MidSideMixer::getSampleFrameStereo(double* inL,  
                                               double* inR, 
                                               double* outL, 
                                               double* outR)
{
 static doubleA mid, side;

 mid   = midGain    * ONE_OVER_SQRT2 * ( *inL + *inR );
 side  = sideGain   * ONE_OVER_SQRT2 * ( *inL - *inR ); 
 *outL = globalGain * ONE_OVER_SQRT2 * (  mid + side );
 *outR = globalGain * ONE_OVER_SQRT2 * (  mid - side );
}
errrmm, yes i know, it's not very smart. i should really collapse all the multiplications into just one. but that plug was not made for public anyway, just for my own fun and as template for more complex plugIns (hello world - so to speak) - so i conveniently skipped such optimizations.
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Thanks braindoc, I'm trying to figure it out :)
Creator of Hya.io - https://hya.io

Post Reply

Return to “DSP and Plugin Development”