Native Mid / Side Processing

[Edited after some much needed sleep and clearer thinking]: Just skip down to this later post for a much simpler and less confusing example…


Earlier thread for reference: https://forum.renoise.com/t/mid-side-processing/25783

I’ve managed to get some basic mid/side processing working natively in Renoise, without the use of additional plugins like Voxengo MSED. I understood the basics of how it worked, and I’ve always suspected that it was possible to do within Renoise, but I’ve never bothered to actually sit down and figure it out until today. It was quite a fun little exercise :)

By running the audio through Renoise’s stereo expander, and then through a series of send tracks that invert and mix everything back together in the correct way (essentially nulling/xor’ing certain parts), it’s possible to isolate the mid (mono) and side (stereo) elements and process them separately.

Here’s a quick example:
http://illformed.org/temp/2009-07-28-mid-side.xrns

Try muting/unmuting the “mid” and “side” tracks to hear the effect.

I’ve used a few more send tracks than is really necessary, but I like to set it up so there’s one dedicated input/receiver track that’s easy to route multiple things to, and also so the individual mid/send tracks are not cluttered with anything unnecessary.

Anyway… just thought I’d share :)

Let’s face it, in real life you can save yourself a whole lot of time by simply using a VST for this, but I always find it interesting to see what kinda nifty stuff we can get natively. Renoise is fun!

.

1 Like

Brilliant!! To be honest there are so many sends that I am a bit confused but I have the xrns anyhow!!
I am all about trying to learn how to do things natively, you save cpu that way!!

Very clever! It’s certainly a bit beyond me as to how this is done, and certainly academic compared to just using a simple VST setup to work on the same aspect. But there you go: you put your head to it in Renoise you can come up with just about anything.

As I’m sure many people have already noticed in the past, if we take an audio signal and combine it with a completely inverted version of itself, the two signals cancel each other out perfectly to create total silence. In other words: 1 + -1 = 0 (Makes total sense, but I was quite surprised the first time I actually tried it in a sample editor!)

You can test this very easily in Renoise by taking a sample and playing two identical notes on two separate tracks, but on the 2nd track you add a Gainer device and invert both the left and right channels.

If we now apply some kind of effect to one of the tracks, we get an interesting result that is the difference between the original signal and the effected version, but in a way that you might not expect at first. For example, if we add a lowpass filter to the 1st track, and leave the 2nd track in its original (but inverted) state, these two signals will now actually combine and create the opposite of a lowpass… a highpass! (Albeit a somewhat crude sounding highpass)

In Renoise, when using the Stereo Expander device, if we set the Expand parameter to “Mono”, Surround to “0%”, and Mono Mix to “[L + R]”, this will actually give us the mid/mono portion from the signal. I thought that fully expanded might also give us the side/stereo portion on its own (which would make this a whole lot easier), but this does not seem to be the case.

Anyway, so, my basic idea was that: signal - mid = side

I tidied up my original example a bit now, since I realised I could do some things slightly differently. It’s still kinda weird, but hopefully it’s a little bit clearer now, haha. In any case, the process of combining these elements and subtracting the bits we need is quite trivial in theory, it just requires some interesting send track and gainer device mathematics :)

http://illformed.org/temp/2009-07-28-mid-side.xrns

[Edit]

Here’s another quick example using a clip from the song “Young Folks” by Peter Bjorn and John. The mid/side isolation technique works particularly well on this song, creating a rather nice vocal extraction effect when you mute the mid portion and leave only the side.

http://illformed.org/temp/2009-07-28-mid-side-2.xrns

Disclaimer: the “Young Folks” sample is obviously copyrighted and is just used here for demonstration purposes. Please be sensible.

1 Like

Well you seem to have the right idea dBlue but your example seemed a little confusing to me so I set about doing one myself. Firstly I’ll run through the mathematics of mid/side processing as I learn it years ago.

Starting with a basic stereo signal you have Left and Right (L & R.) Getting your Mid and Side (also known as Sum and Difference) signal from this is easy (especially as you pointed out you can invert channels with the Gainer.)

Mid = Left + Right
Side = Left - Right (Well side is really the difference and you could use Right - Left, you would just have to make sure to invert the correct one when recombining.)

As all Renoise tracks are stereo there is no need to invert all and combine in other Send tracks. Mid is a basic Mono conversion, as you did with the Stereo Expander. Now for the Side you want a Gainer to invert the Right channel then again convert to Mono. This should give you two dual-mono channels, which allows you to easily monitor either the sum or the difference signals.

Now combinations back into stereo is a little (but not much) more complicated.

Left = Mid + Side = (L+R) + (L-R) = 2L
Right = Mid - Side = (L+R) - (L-R) = 2R

As you can see the recombinations actually gives you double the signal so I have set the outputs of the left and right channels at -6dB.

The recombinations itself is basically the same though. Mid and Side and both sent to the Left channel (Send Track) which is panned left (and the minus 6dB mentioned earlier.) Then the Side track is sent to one called Inv which inverts both left and right (as it’s dual mono) before being sent onto the Right channel. This could easily be put in the end of the chain of the Side track but wanted to leave the option to monitor the Side channel on its own it it’s original state (although inverted signals are usually considered audibly indistinguishable from each other.)

WOW! I seem to have lost myself in writing that even more than I did quickly looking at your own example. Anyway here is what I did and it should be quite similar to yours. Hope it makes sense and maybe hopes people understand and simplify things :)

Sorry forgot to add the link to the .xrns.

http://www.sendspace.com/file/6uosoh

Kickass! I do tend to go overboard with the send tracks sometimes, haha, but I guess each person has their own weird style. Your example is definitely easier to follow and understand than my mess :D

Yay for workarounds!!!

When I get back home, I’ll try feeding Jimi Hendrix through this -
It might prove to be even more psychedelic sounding than the original :)

Yeah but if it wasn’t for you pointing out that the Gainer has Invert I wouldn’t of even realised it was possible.

Am I right in thinking in your example it remains in M/S rather than going back to L/R for normal playback? I didn’t study it as closely as I should of, got lost and tried my own to make cleared sense of it ;)

Yeah, I just isolated things in a slightly different (and unnecessarily complex) way, but it still combines to give the correct result in the end.

I loaded Renoise again now after having some sleep and clearing my head. Here is another version which is much simpler, requiring only 1 send track to do the processing, 1 send track to receive the mid data, and 1 send track for side data.

http://illformed.org/temp/2009-07-28-mid-side-3.xrns

whew :)

You could of course separate things further into left and right side data, if you wanted to apply totally different effects to each one for some reason. That’s not really what I had in mind, so I didn’t bother.

.

Nifty little example… write a small explanation into the song comments box and i’d vote this to be included into Renoise as tutorial song. :)

Something’s not quite sitting right with me and how you get your Side signal and as far as I can see you are never converting back into L/R stereo for normal playback, just mixing the M/S signals together.

EDIT2: Just rendered the Side signal only and it is out of phase. Mid and Side should each be Mono (single channel) signals so this obviously isn’t correct.

1 Like

The way I obtain the side signal: First I run the original signal through the stereo expander set to mono, which gives us the mid signal. I take that mid signal and invert it, and then mix it back with the original signal, causing the mono information to cancel itself out to silence. As far as I understand it, the remaining data leftover from this process - the mathematical difference between the original signal and the mid signal - is the side signal?

It’s very possible that I’ve missed something, but to confirm that I was getting the correct output, I was simply comparing my results in Renoise to those created by Voxengo’s MSED plugin when used in the default “inline” mode. Using the inverted phase cancellation technique, my output from Renoise mixed with the inverted output of MSED results in silence, which tells me that they are both producing identical results. I tested this overall, as well as for the individual mid and side signals.

Regarding your comment about converting back to L/R for normal playback, I am probably missing something here as well, but I don’t see why it’s necessary in this case? The output of the process already recombines to create a result that is identical to the original, untouched signal.

[Edit]
Additional L/R processing is probably required in order to maintain correct phase, if you were to apply any kind of effects to one of the signals… is that it?

I showed you the matematics above of how to get from stereo to mid/side and back again. Mixing mid/side signal together does not give you stereo. The reason it appears to in your example is because you side signal is out of phase on each channel. Remember Mid/Side should only be two channels and you have three (although one is simply anti-phase) ignoring the fact we technically always have to work with four.

You Mid is a basic mono, which is correct, although you would usually use one channel rather than dual-mono but that’s all Renoise will work with.

You Side has the correct signal on one side and the inverted signal on the other. This is going to give you serious phase cancellations when listening to it through your monitors! Although the result of this is that when mixed back with the Mid signal you have Mid+Side for Left and Mid-Side for Right and do get stereo back again with no extra workings (which has also shown me how much easier it is to get back to Stereo than how I did it in my example as it’s unlikely many people are going to want to effect left and Right separately.)

Although, at the end of the day most effects work same on positive and negative half-cycles and if you never monitor your Side on it’s own to see how much difference your effects are making on that part of the signal you will probably never notice. Personally I know I would want to listen to the changed I am making to my Mid and Side signals in isolation so would want to avoid anti-phase signals being routable to output.

Gotcha. I did notice earlier that the “side” I was getting was out of phase, and that this did not really fit in with the correct methods you mentioned, but it seemed like this method in Renoise was a happy little quirk we could take advantage of :)

Definitely very important to look after those monitors though! I had overlooked that vital concept with the phase. I have not worked with monitors for several years now, I just have some awful desktop speakers that make it impossible to truly know what the hell is going on… gah! I obviously heard the weirdness of the phase being wrong, but it did not jump out at me as being REAAAAALLY wrong… and since my right speaker is kinda crappy anyway… well, you get the idea. It simply didn’t occur to me at the time, especially since the end result was OK.

Anyway… good stuff. I love these threads, haha.

I definitely want to see what other kind of weird tricks are possible :)

Yeah definitely interesting stuff! Glad you get what I’m saying and must admit it took me a while to work out why yours was working (which it obviously was) until I broke it down mentally. Listening on headphones at work myself and don’t have a great set-up at home for critical listening but always try and be aware of things like phase issues and CD offset.

Tried to have a think of how to neaten my example up and remove the dedicated L&R Sends and although it could be done easy enough it would force you to use another Gainer device which you would have to turn on and off depending on if listening to the stereo mixdown or just to the Side signal. This I consider messier (or more prone to user-error at least) than using a couple of extra Sends and maybe some people would like to effect each channel separately… Can easily move the Inv Send to the end of the Side one though.

Shame this thread has shown me that Sends can only be routed to others further down the chain, had been tempted to play about with some strange feedback things at times but now I know it’s not actually possible. Maybe I’ll start playing about with Synth Edit or the like and see what sort of thing I come up with… But I never get around to making enough music as it is!

Actually in computer terms, inverted is doing nothing more than making 1 bits 0 and 0 bits 1.
And if you do 1 AND 0, the result is always 0 ;) (because both samples disolve in eachother that way)

That’s all I was trying to say, Mr. Smartypants :P

And this is all you have to do to invert an audio signal in the digital realm due to the way it is represented (well the way most formats work, don’t rely on Wikipedia to tell you how PCM works.) Centre of the waveform is 0000 (assuming four bits), maximum positive peak is 0111 and lowest negative peak is 1000. Does mean waveforms are offset to the negative by a single bit but allows you to use simple addition of values and have it behave like a real waveform, with two negative values giving a greater negative value (although you have to remember to drop the produced MSB) and so on and simple inversion, Was almost tempted to draw a little Paint diagram but too lazy and you probably all know this anyway.

Not sure what you are talking about here. Sounds like you are referring to binary logic but as nobody else had done I wasn’t quite sure…

Whoa, this is amazing! I ask one question and a huge thread has emerged from it! Thank you dblue for being inspired to figure out a method…this is one of the reasons why I love Renoise, it has a great community behind it! :)