# Is there an M/S encoder with Left & Right sides separate?

Been playing for a while trying to get an M/S encoder which gives me the left sides only & the right sides only, but it’s tricky problem! It seems like M/S encoding doesn’t really work if you have hard panned signals.

I.E. when you have something which is a 1 in the L channel and a 0 in the right channel, you’d kinda of expect mids to be zero, and left side to be 1, and right side to be 0, but I’m struggling to find the right equation to get those results. I was using this for a while which I thought was working, but realizing now not at all

``````mid = left + right / 2
left_side = left_sample - mid
right_right = right_sample - mid
``````

so if L is 1 & R is 1

``````mid = 1
left_side = 0
right_side = 0
``````

but if left is 1 & right is 0

``````mid = 0.5
left_side = 0.5
right_side = -0.5
``````

hmmmmm… happy to share a better M/S encode / decode. it’s kind of important to me conceptually that the left & right sides are able to be considered separately… but perhaps this simply isn’t possible?

even if we use the conventional:

``````mid = Left - Right
side = Left + Right

Left = 1 , Right = 0
mid = 1
side = 1
``````

how in the world is that supposed to work? 0.o

What you want to do is not possible to do with just an MS-encoder.

1 Like

thanks Xenakios – I suppose now I can stop wasting my time with it!

I think there is some confusion:

a) Mid = (left + right) / 2 => average of the stereo channels
b) To reconstruct: left = mid + side | right = mid - side

For mono compatibility a hard panned signal must be present in the mid signal, otherwise a stereo record on a mono player would not play.

Mono compatibility is broken for anti phase:

• if left = -right => mid = 0

It is by design, that if one channel is silent, the other is still heard through the middle.

Well there’s a lot of ways to skin the cat but this doesn’t sit right:

It is by design, that if one channel is silent, the other is still heard through the middle.

I understand perhaps in the use of M/S encoding for sending signals across airwaves or other tactics for non music instrument purposes, but in the context of music application it’s desirable for this bleed to not occur.

I’ve switched back to the deconstruction being the standard way, but it still doesn’t solve the lack of ability to apply different effects to the left sides & right sides:

``````outMids.setSample(0, i, left_sample + right_sample);
outSides.setSample(0, i, left_sample - right_sample);

outAudioBuffer.setSample(0, i, (mid_sample + side_sample) * minus_six_db);
outAudioBuffer.setSample(1, i, (mid_sample - side_sample) * minus_six_db);
``````

What I’m really keen to figure out is a way which would be as in the original post:

``````mid = left + right
left_side = left_sample - ?
right_right = right_sample - ?
``````

I’ve tried a lot of variations on the M/S encoder though and it doesn’t seem like there’s a suitable solution for this…

That’s not possible, as what you wish are three channels of independent information, but what you’ve got to work with are only two channels of independent information. With linear math, that’s simply not doable. You would need some methods in the field of source separation or parametric upmixing to create a LCR signal from stereo.
Otherwise, applying effects to L or R will always affect the sources in the center. And there never has been a native center in stereo, but only a perceived one (phantom source).

3 Likes

Ahh I see Daniel, I feel goofy for the idea! that seems obvious now.

Thanks for the reply.

I’ve always disliked calling it “Mid and Side” I prefer “Sum and Diff”. It’s a more accurate representation of what you have.

2 Likes

Agreed! It’s really not the sauce. We need better stereo imagining techniques.

I actually prefer “Omni and Eight” as these are the underlying directivity patterns. L and R will then be Cardioids pointing to the left and right, respectively.

Nerdy fun fact: add an Eight for front-back and another Eight pattern for up-below and you’ll get First order Ambisonics

1 Like

What do you mean by add an eight? I’d like to add gain control for front & back… xP

`+= 8`

Lol… the name to google is Alan Blumlein:

Although the page explains it a bit different than from how I learned it. I guess there are two setups he invented. Normally you use an omni microphone to record the mid signal and a 90 degree to the viewing axis tilted 8 microphone, that captures the side signal.

You could also call it lateral and vertical after the movements the needle does on a vinyl record.
Mono needles will only capture lateral movements.
You find that on some vintage compressors…

1 Like

The Mid-Side recording technique involves having a central microphone, pointing forward, typically with a cardioid pattern and then another microphone perpendicular to the first, using a figure-8 (or some other bidirectional pattern). The bidirectional microphone records the sides - anything not directly infront of the microhpones - while the first records the mids (as well as some of the sides, since the cardioid pattern only ignored sounds from directly behind). Because the bidirectional mic is recording into one channel, if you stand on the left and hit a drum, the signal will peak in positive numbers, if you then move around to the right side and hit your drum again, the signal will peak in negative numbers - meanwhile the mid mic will record both peaks in positive numbers. Put simply, this means that the left-only signal is the normal-phase side signal and the right-only signal is the negative-phase side signal.
Obviously if you try to play that back in mono both channels will cancel each other out and you’ll hear silence. That’s why you need to pan the channels left and right accordingly.

No you wouldn’t - that’s not how mid-side works. Like I said above, the mid microphone still records some of the signal directly perpendicular to the way it’s facing - meaning if you stand at 90 degrees to the mid mic and talk, your voice will be heard in both the mid and the side channels - but the mid channel would be quieter. So when you have a +1 in the left channel, and 0 in the right channel, you’d expect the mid channel to be +0.5.

The whole idea of Mid-Side is that you can record a sound which when mixed down to mono, doesn’t lose any of the signal due to phase cancelations (since the left and right side channels cancel eachother out exactly, so you’re left with only the original Mid recording). You can then decode the Mid-Side recording to get a typical stereo recording which also shouldn’t have any phasing issues since, no matter where the source sound is coming from, it’ll always be in-phase for the channel it’s heard on (I.E, if it’s to the left, it’ll be in-phase on the left channel, in-phase on the mid channel, and out-of-phase on the right channel… which is then inverted, making it in-phase again).