# Stereo expansion algorithm

Started by July 6, 2004
```Hi,

Can anybody point me in the direction of a decent 'stereo expansion'
algorithm (by this I mean the sort of thing commonly found in e.g.
TVs, that makes a normal stereo image sound wider than it actually
is)?

Thanks,
Jesper
```
```float mono = (left+right)*.5;
left -= amount * mono;
right -= amount * mono;

For 0. < amount <= 1.

That's basically all there is to it.

--smb

jbek@altavista.net (Jesper B. Kristensen) wrote in message
> Hi,
>
> Can anybody point me in the direction of a decent 'stereo expansion'
> algorithm (by this I mean the sort of thing commonly found in e.g.
> TVs, that makes a normal stereo image sound wider than it actually
> is)?
>
> Thanks,
> Jesper
```
```Jesper B. Kristensen wrote:

> Hi,
>
> Can anybody point me in the direction of a decent 'stereo expansion'
> algorithm (by this I mean the sort of thing commonly found in e.g.
> TVs, that makes a normal stereo image sound wider than it actually
> is)?
>
> Thanks,
> Jesper

Lets take it from half way. Suppose the signal were like FM: a mono
signal, or S(um), and the channel difference, or D(ifference). Then to
get L(eft) and R(ight), we use the relations (ignoring scale factors)

L = S - D  and   R = S + D

Of course, we can also perform   L' = S - kD  and   R' = S + kD
where the primed values have more or less separation than the unprimed
depending whether k is more or less than unity.

OK, you say, but I start with L and R.; then what? Again ignoring scale
factors, S = L + R (that's why it's the sum) and D = R - L (that's ...).

The fewer adds and subtracts you do, the healthier your signals will be,
so crank through the algebra and come up with expressions of the form
L' = L + f(k, R)
I could do it for you, but I won't unless you admit you know so little
algebra that can't do it yourself.

You don't actually need the scale factors, but you need to keep track of
where they're left out in order to get the right action for your k.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;

```
```If the original source was mono, then it seems this algorithm would result in a
softer overall level, no?  I have a Sony "boombox" that makes stereo sounds
wider and leave mono sounds unaffected.  I wonder how this works?

BTW, another way to make something sound wider is to delay the L relative to the
R (tens of milliseconds range).  I doubt that TV's use this algorithm since it
is fairly difficult to do in the analog domain, but it does have an interesting
effect and is usually trivial to do digitally.

On a related note, I read about an algorithm used to synthesize stereo from mono
that goes like this:
L = mono + amount*mono_delayed
R = mono - amount*mono_delayed
where mono_delayed is mono delayed in the tens of milliseconds range and amount
is a scaling factor.

The main advantage of this algorithm is that it is perfectly "mono compatible",
i.e. if played back in mono you end up with just the original mono signal (no
phase cancellation).

"Stephan M. Bernsee" <spam@dspdimension.com> wrote in message
> float mono = (left+right)*.5;
> left -= amount * mono;
> right -= amount * mono;
>
> For 0. < amount <= 1.
>
> That's basically all there is to it.
>
> --smb
>
>
> jbek@altavista.net (Jesper B. Kristensen) wrote in message
> > Hi,
> >
> > Can anybody point me in the direction of a decent 'stereo expansion'
> > algorithm (by this I mean the sort of thing commonly found in e.g.
> > TVs, that makes a normal stereo image sound wider than it actually
> > is)?
> >
> > Thanks,
> > Jesper

```
```Stephan M. Bernsee wrote:
> float mono = (left+right)*.5;
> left -= amount * mono;
> right -= amount * mono;
>
> For 0. < amount <= 1.
>
> That's basically all there is to it.

Typo? right += amount * mono; ?
>
> --smb
>
>
> jbek@altavista.net (Jesper B. Kristensen) wrote in message
>
>>Hi,
>>
>>Can anybody point me in the direction of a decent 'stereo expansion'
>>algorithm (by this I mean the sort of thing commonly found in e.g.
>>TVs, that makes a normal stereo image sound wider than it actually
>>is)?
>>
>>Thanks,
>>Jesper

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;

```
```No typo. You subtract the center part of the stereo image from both
the left and right channels. This will emphasize anything that is not
present in both channels, therefore making the stereo image appear
"wider". It is true that the overall signal level drops if you have a
mono signal, but I guess you could just switch the algorithm off in
that case. Checking for mono is fairly easy, for example by making
sure fabs(left-right) is always below a certain threshold.

--smb

Jerry Avins <jya@ieee.org> wrote in message
news:<40eb15e6\$0\$3088\$61fed72c@news.rcn.com>...
> Stephan M. Bernsee wrote:
> > float mono = (left+right)*.5;
> > left -= amount * mono;
> > right -= amount * mono;
> >
> > For 0. < amount <= 1.
> >
> > That's basically all there is to it.
>
> Typo? right += amount * mono; ?
> >
> > --smb
> >
> >
> > jbek@altavista.net (Jesper B. Kristensen) wrote in message
> >
> >>Hi,
> >>
> >>Can anybody point me in the direction of a decent 'stereo expansion'
> >>algorithm (by this I mean the sort of thing commonly found in e.g.
> >>TVs, that makes a normal stereo image sound wider than it actually
> >>is)?
> >>
> >>Thanks,
> >>Jesper
>
> Jerry
```
```> BTW, another way to make something sound wider is to delay the L relative
to the
> R (tens of milliseconds range).  I doubt that TV's use this algorithm
since it
> is fairly difficult to do in the analog domain, but it does have an
interesting
> effect and is usually trivial to do digitally.

To delay L relative to R is basically the same as changing its phase (or
delaying whole periods). A simple capacitor circuit would do the trick then.
So not difficult at all ;-)
You even get this type of channel delay if you're messing up your pcb design
or using inferior components (with a huge deviation factor). Done that a
million of times ;)

Cheers,

Rob

```
```Rob Vermeulen wrote:

>>BTW, another way to make something sound wider is to delay the L relative
>
> to the
>
>>R (tens of milliseconds range).  I doubt that TV's use this algorithm
>
> since it
>
>>is fairly difficult to do in the analog domain, but it does have an
>
> interesting
>
>>effect and is usually trivial to do digitally.
>
>
> To delay L relative to R is basically the same as changing its phase (or
> delaying whole periods). A simple capacitor circuit would do the trick then.
> So not difficult at all ;-)

I think you want a delay independent of frequency. Not so easy with R-C.

> You even get this type of channel delay if you're messing up your pcb design
> or using inferior components (with a huge deviation factor). Done that a
> million of times ;)

What is "deviation factor"? Deviation from what?

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;

```
```Stephan M. Bernsee wrote:

> No typo. You subtract the center part of the stereo image from both
> the left and right channels. This will emphasize anything that is not
> present in both channels, therefore making the stereo image appear
> "wider". It is true that the overall signal level drops if you have a
> mono signal, but I guess you could just switch the algorithm off in
> that case. Checking for mono is fairly easy, for example by making
> sure fabs(left-right) is always below a certain threshold.
>
> --smb

Danke!

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;

```
```Hi Stephen,

> Jerry Avins <jya@ieee.org> wrote in message
news:<40eb15e6\$0\$3088\$61fed72c@news.rcn.com>...
> > Stephan M. Bernsee wrote:
> > > float mono = (left+right)*.5;
> > > left -= amount * mono;
> > > right -= amount * mono;
> > >

Note that this degenerates to:

L -= k*R;
R -= k*L;

If k can vary from -1 to +1 then you get a control that will go from
MONO to full centre cancelation (karaoke?) which is also MONO, but
speakers out of phase.

Regards

Robert
```