stereo to left - center - right

matheus leston's icon

hey guys

i'm trying to create a patch to separate left, center and right from a stereo input. i have searched the web and the forum and i could find information about converting stereo to mid/side, but wasn't very lucky with L/C/R.

can anyone help?
thanks

Floating Point's icon

i'd settle with C=(L+R)/2, which makes it consistent with extracting the mid signal from a mid-side encoding

jamesson's icon

I would respectfully disagree, unless I'm misguided about the nature of signal summing. M is everything L and R have _in common_. You're looking to do phase-inversion noise cancellation in reverse, in which whatever is in common between two signals is discarded. How to do this in Max I have no clue.

matheus leston's icon

Thank you for your answers!

Terry, I think (L+R)/2 would work for Mid / Side processing. But what I want to do is to separate what is only in the left channel, what is only in the right and what is common to them. If I have a sound going only to the L channel, using (L+R)/2 would give me half of that sound on the center channel.

Jamesson, I was trying to find a solution using phase, but couldn't. To remove the center is as easy as L + (R x -1). But I will end up with one mono file that is the combination of the sides. Now, how to separate what belongs to L and R? And how to do the reverse process that you said in order to bring the center with no sides?

matheus leston's icon

Guys, I think I got it.

I used a lot of phase canceling, separating the positive and negative parts of each signal and combining them later. Seems to work.

Max Patch
Copy patch and select New From Clipboard in Max.

Please, let me know what you think.

jamesson's icon

matheusleston, I havent seen the patch but I'm positive you did it right

Floating Point's icon

well I had a look at your patch and it seems to create a lot of distortion out of sine wave input.
I think there is a problem with your assumptions, which we can see more clearly with a bit of simple algebra.
You are confusing the actual signals with the signal channels here.

SO the left channel, L, contains the unique part of its content, l, and half what is common, c/2,
ie L=l+c/2
likewise:
R=r+c/2

Now to extract what is common (what you want to go into the centre channel), in terms of R and L is algebraically impossible, because you don't know what l and r are (l and r don't cancel out ), and if you did then you wouldn't have the problem in the first place. This is why, when in cinema sound track production, if you want a centre channel, you 'manually' choose to route material to that channel, rather than trying to extract it from the existing L and R, and usually it is the sum of all the stems, attenuated ( (L+R)/2 ), which happens to be consistent with the mid channel for M/S encoding. So it's a convention more than anything else.

matheus leston's icon

Terry, thank you very much for analyzing the patch. I'm no specialist, and this was trial and error. I'm learning!

Actually I built this to work with a Jitter patch for a live concert with three projection screens, and it seems to work great with it. But what kind of sine wave distortion did you get? I'm getting normal sine waves here: using cycle~ on the input, the wave is pretty much the same at the end, and I can cancel both of them with -~.

The assumption I did was the following: if each channel has its unique contents and half of the center (r+c/2 and l+c/2), by doing a 180º shift in one of them and summing them together we would cancel the center - that standard method. the resulting audio is a combination of l and -r, with no c.

If I separate the negative part of this resulting signal (with clip~ -1 0), it will contain the negative information of l and the inverted positive information of r. This will be combined with the positive information of R (clip~ 0 1), witch contains r+c/2. The inverted r will be canceled with the normal r and the result will contain the positive part of c/2 and the negative part of l.

Doing the inverted principle, I can get the negative part of c/2 and the positive of l, and restore the signals.

Max Patch
Copy patch and select New From Clipboard in Max.

This is just part of the patch trying to explain what I thought.

What is wrong?

Thanks!

Floating Point's icon

In your patch, I assume that the single source is one channel, namely R. Your logic is correct until you introduce the L term ( (-R)+L ). Where does the 'L' come from? It's actually 0, 0 because anything + (anything*-1) = 0. So you put the signal through these various processes and end up with the positive half of the original signal-- you end up having less information than you did at the start.

Max Patch
Copy patch and select New From Clipboard in Max.

Here's your patch with the modified labels:

Max Patch
Copy patch and select New From Clipboard in Max.

Here is an encapsulated version of the other patch, with different signals going into either Left, Right, or 'centre' which goes into both left and right equally (labelled common):

You can see that it will route signals correctly only if there is either:
--nothing in one of the inlets
--the same signal in both

which are special cases

hope that's clear

matheus leston's icon

Sorry, it was a problem of how I constructed the patch. It was not clear: I wanted to represent a sound on center, going to both channels (on both sides of the +~, one being inverted). That's L+(-R), the center being canceled.

And I found out what the problem is. You are right: it works as long as the signal is the same. What happens is that on the process of canceling (-r) and r, leaving l at the negative portion and c/2 at the positive, both signals are changed (because r and l are not the same).

Thank you for your help. I think it is a problem that cannot be solved, as you said. But as i'm using it only to generate video, it will work.

do.while's icon

oh thanks guys ❤

Roman Thilenius's icon


what is only left?

everything in left is only left, because you can not substract something from left which is not there.

only left and all of left is the same, it cant know its own difference to right.