Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Thoughts on stereo field

DSP related issues, mathematics, processing and techniques

Re: Thoughts on stereo field

Postby tulamide » Sun Mar 06, 2016 10:18 am

KG_is_back wrote:When widening the stereo field, you are basically boosting the difference between the channels.

The more I play with it the more questions arise :lol:
If I wanted to visually present the user with the stereo width by a meter, I could basically present the difference between mid and side. But I'm struggling with the max and min difference. Let's see the distances:

L and R both -1: mid = -2 * 0.7071 = -1.4142; side = 0
L and R both +1: mid = +1.4142; side = 0

L = 0, R = 0: mid = 0; side = 0
L = 0, R = 1: mid = 0.7071; side = -0.7071
L = 0, R = -1: mid = -0.7071; side = 0.7071

The largest distance, no matter what, seems to be 2 * sqrt(0.5). But how would I best calculate the distance? If I just do
Code: Select all
abs(mid) + abs(side)

I get a distance, but no direction (phase). Also, I remember that abs() is to be avoided, because it's so slow. But if I use conditionals, the code gets bloated.

Do you have another wise advice?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Thoughts on stereo field

Postby KG_is_back » Sun Mar 06, 2016 11:00 am

tulamide wrote:Do you have another wise advice?


Just send the mid and side channels to envelope followers (there is one in the tool-box) or some sort of RMS meter.

I think it would be more reasonable to express the width-measurement by ratio of mid and side. That way, the system will be volume-invariant (width will not be affected by overall gain).
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Thoughts on stereo field

Postby tulamide » Mon Mar 07, 2016 9:23 pm

KG_is_back wrote:I think it would be more reasonable to express the width-measurement by ratio of mid and side. That way, the system will be volume-invariant (width will not be affected by overall gain).

That's actually what I'm after. So just mid/side? (I'm always insecure when something looks simple, because I assume to miss something)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Thoughts on stereo field

Postby KG_is_back » Mon Mar 07, 2016 10:06 pm

I would go with side/mid to prevent division by zero. In real world scenario signal with some side and no mid elements is basically 100% out of phase, which means it is completely mono-incompatible. Mixing engineers generally avoid such scenarios. You will still have to somehow deal with issue when signal is silent (side/mid=0/0). Easiest would be using max function, preventing mid envelope to drop below some very small value, for example:
Code: Select all
width=side/max(mid,1e-10);

Note, that mid and side here refers to their envelopes form envelope follower - not the original mid and side channels.

tulamide wrote:(I'm always insecure when something looks simple, because I assume to miss something)


In such cases, the best thing to do is to analyze the solution. Look for extreme cases, where you suspect the solution might fail, both mathematically and practically. It is also good idea to analyse what the solution suppose to represent vs. what is actually represents.
For example in this case, the measured width actually represents ratio of side and mid channel. Is that the actual width of the stereo field as perceived by humans? For example, consider scenario when both L and R channels are identical but out of phase. The mid channel is zero and side is at maximum. System measures infinite width... but do out-of-phase signals actually sound infinitely wide? or just unnatural...
Similarly, it is possible to create apparent effect of audio coming directly from one side, by delaying one of the L/R channels in 1ms range (sound-travel-distance of human ears). In frequencies below 1kHz (1 / 1ms), this will result in less than full phase shift, and thus signal will still have very prominent mid-channel, although it sounds as coming directly from side. The mid-side analysis of the signal can't recognize these time-based effects, because it only analyses the phase-direction-relationship of the channels. It clearly produces incomplete picture about width.

All solutions have their limitations... whether they are simple or complex...
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Thoughts on stereo field

Postby Rocko » Wed Jun 22, 2016 2:33 pm

I'd like to point out an interesting 'error' of M/S separation technique.
Consider a simple M/S separator, for instance an 'MS matrix' plugin which gives you control of 'Mid volume' over 'sides volume' (example: MSED by voxengo which is free and nice).
In this case it is used for mixing and mastering, not 'synth widening' so input is unknown.

The algorithm should go something like this (pseudo code):

Code: Select all
monoin Lin,Rin,Mgain,Sgain;
monoout Lout,Rout;
float M,S;

M = (Lin+Rin)*Mgain;
S = (Lin-Rin)*Sgain;

Lout = (M+S)*0.5;
Rout = (M-S)*0.5;


Now consider a case in which the input is on left side only (right channel is zero momentarily) and user dials in 'Mgain = 1, Sgain =0' (just mid, no sides).
The output should be zero (as input is fully panned to left), all input is 'side' no input is 'mid'.
In fact the output will be:

Lout = (Lin+Rin+0)*0.5 = 0.5*a
Rout = (Lin+Rin+0)*0.5 = 0.5*a

which is wrong.
Thus, MS matrixes tend to blend the sides with mid at 'hard panned' input and low setting of 'Sgain'.

...
Interesting
Rocko
 
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Re: Thoughts on stereo field

Postby KG_is_back » Wed Jun 22, 2016 3:02 pm

Rocko wrote:The output should be zero (as input is fully panned to left), all input is 'side' no input is 'mid'.
In fact the output will be:


No... When signal is hard panned left, then mid and side elements are in perfect balance, such that the destructively add in the right channel. Signal is pure "side" if and only if the left and right channel have opposite phases.

In MS vs LR configuration, Left and right do not refer to "east-west" 180° opposite directions. Instead they reffer to diagonal directions. "Left" is 45° left of forward and "right" is 45°right of forward. Forward being the "mid" and "side" being the 90° left/right.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Thoughts on stereo field

Postby Rocko » Wed Jun 22, 2016 3:51 pm

Thanks KG, this makes things much clearer.
So, by setting an MS matrix to [M=1 ; S=0], I'm actually moving all sound to 'vertical axis'.

To sharpen my understanding, what technique should I use then, if I want to separate between "center" or "phantom center" and the "none center" material?
Any idea? How can I 'pick up' only the center content from a stereophonic recording?

In this case, if input is 'hard panned' then output to center channel is zero.
Rocko
 
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Re: Thoughts on stereo field

Postby KG_is_back » Wed Jun 22, 2016 7:57 pm

Rocko wrote:Any idea? How can I 'pick up' only the center content from a stereophonic recording?

In this case, if input is 'hard panned' then output to center channel is zero.


It is possible, I've seen plug-ins that can do that. However, I have no idea how they actually work. They seem to involve FFT. For example this one: https://helpx.adobe.com/audition/using/stereo-imagery-effects.html
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Thoughts on stereo field

Postby tulamide » Wed Jun 22, 2016 10:38 pm

Just a thought and probably totally wrong. But maybe it serves as a start into that matter:

We sense a sound as mono, if both channels are exactly the same. The more differences, the more stereo field. Shouldn't it be just a matter of detecting the differences, which would be the left/right parts and the commons, which would be the center part?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Thoughts on stereo field

Postby KG_is_back » Thu Jun 23, 2016 12:55 am

tulamide wrote:Just a thought and probably totally wrong. But maybe it serves as a start into that matter:

We sense a sound as mono, if both channels are exactly the same. The more differences, the more stereo field. Shouldn't it be just a matter of detecting the differences, which would be the left/right parts and the commons, which would be the center part?


Yes, that is correct. The hard part is the actual detection of common elements in the audio channels. I reckon that from FFT you simply pick frequencies that have common phase element and also similar magnitude. I would have to look much deeper into it and code it properly, which I don't really look forward to at the moment.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

PreviousNext

Return to DSP

Who is online

Users browsing this forum: No registered users and 7 guests