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

**URL:** <https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858>\
**Category:** General JUCE discussion\
**Created:** [July 8, 2021, 2:32pm UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858 "2021-07-08T14:32:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ian-SAfc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ian-safc/32/17877_2.png) [@Ian-SAfc](https://forum.juce.com/u/Ian-SAfc)\
**Post date:** [July 8, 2021, 2:32pm UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/1 "2021-07-08T14:32:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [July 8, 2021, 3:45pm UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/2 "2021-07-08T15:45:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DaveH](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daveh/32/4924_2.png) [@DaveH](https://forum.juce.com/u/DaveH)\
**Post date:** [July 8, 2021, 7:15pm UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/3 "2021-07-08T19:15:48Z")

</div>

You want Juce to make you a cup of tea too? 😛 😁

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](https://www.musicdsp.org/en/latest/Effects/256-stereo-width-control-obtained-via-transfromation-matrix.html?highlight=width)

---

<div class="post-metadata">

**Author:** ![Ian-SAfc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ian-safc/32/17877_2.png) [@Ian-SAfc](https://forum.juce.com/u/Ian-SAfc)\
**Post date:** [July 8, 2021, 7:40pm UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/4 "2021-07-08T19:40:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DaveH](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daveh/32/4924_2.png) [@DaveH](https://forum.juce.com/u/DaveH)\
**Post date:** [July 8, 2021, 8:05pm UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/5 "2021-07-08T20:05:38Z")

</div>

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](https://www.musicdsp.org/en/latest/index.html)

---

<div class="post-metadata">

**Author:** ![asimilon](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/asimilon/32/4235_2.png) [@asimilon](https://forum.juce.com/u/asimilon)\
**Post date:** [July 9, 2021, 7:15am UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/6 "2021-07-09T07:15:18Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ujam](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@ujam](https://forum.juce.com/u/ujam)\
**Post date:** [July 9, 2021, 7:24am UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/7 "2021-07-09T07:24:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mrugalla](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mrugalla/32/13092_2.png) [@Mrugalla](https://forum.juce.com/u/Mrugalla)\
**Post date:** [July 9, 2021, 7:58am UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/8 "2021-07-09T07:58:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [July 9, 2021, 1:00pm UTC](https://forum.juce.com/t/is-there-a-stereo-width-processor-widget-in-the-juce-dsp/46858/9 "2021-07-09T13:00:05Z")

</div>

I wrote this hack-job a while ago based on some music dsp code. [squarepine\_core/StereoWidthProcessor.cpp at main · SquarePine/squarepine\_core · GitHub](https://github.com/SquarePine/squarepine_core/blob/main/modules/squarepine_audio/effects/StereoWidthProcessor.cpp#L65)
