Is there a "Stereo Width" processor/widget in the Juce DSP?

I had a quick look, I couldn’t find one unless its named something different.
Is it there under a different name?

There is not Stereo Width as such. Different signals need different treatment.

If the signal is already stereo you can modify the width by converting to mid-side encoding, amplify or attenuate the side signal and convert back to left-right. The formula is trivial and can even be done using buffer.copyFrom and addFrom calls for the whole buffer.

Creating a stereo sound from a mono signal is more difficult and usually involves psychoacoustic methods that create an artificial side signal. I would be interested as well if there is literature about how this would be implemented.

1 Like

You want Juce to make you a cup of tea too? :stuck_out_tongue: :grin:

Seriously though, have you tried Music DSP web site? It’s old, and it’s very useful.
This stereo width code is simple, but effective:-
https://www.musicdsp.org/en/latest/Effects/256-stereo-width-control-obtained-via-transfromation-matrix.html?highlight=width

2 Likes

@DaveH
Thanks. Thats a useful collection.
Although I am guessing that most of those modules can’t be used in a commercial plugin.

That particular code has this ‘ This work is hereby placed in the public domain for all purposes, including use in commercial applications.’ - in the description. I don’t know about the others. A lot of people shared their code on there, but it’s worth checking them individually.
From here you can see they were all publicly posted on a mailing list years ago…Musicdsp.org — Musicdsp.org documentation

2 Likes

That code is the M/S method @daniel talked about.

Some other methods that can be used to widen a signal include:

  • Delay one channel very slightly (< 40ms)
    – this has the disadvantage of having extremely poor mono compatibility, and the closer you get to 40ms the signal appears to pan as well + will start to be able to hear the delay itself. There are some good videos on YouTube about Haas Delay that explain this.

  • The “opposite EQ” trick
    – apply a small boost in one channel with a matching small cut in the other channel

  • Very small pitch adjustments on one channel only
    – more difficult to implement, mono compatibility also likely sucks (haven’t actually tried this one)

Anyone got any others?

A variation of “Delay one channel very slightly” is to take left+right, delay it, and add it to the left but subtract it from the right. Then you avoid the mono compatibility problem as it cancels out.

1 Like

you could also put a saturating waveshaper on the side-signal only to enhance the width not directly by applying gain, but mostly by adding harmonics. 100% mono compatible results as well

1 Like

I wrote this hack-job a while ago based on some music dsp code. squarepine_core/StereoWidthProcessor.cpp at main · SquarePine/squarepine_core · GitHub