# [Freeswitch-dev] Stereo support?

Rick van Rein rick at openfortress.nl
Fri Dec 14 02:07:07 MSK 2012

```Hello,

> the difficult part is how to figure out if someone is looked at
> someone?

Assuming that they delivered stereo microphone sound, which is a stretch in
today's setups (a chicken-egg problem) it would be trivial I think.  You
would basically do a calculation like

tan (alpha) = (R - L) / 0.5 * (R + L)

and find in alpha the angle right from straight-forward.  Of course it is
useful to dampen movements with a low-pass filter on momentary calculations,
and/or to make these calculations over periods rather than for each
individual audio sample pair.

If the switch is aware what person is put in what position it could figure
out which other is addressed.  That might call for a switch that does this
work separately for each participant.

I suppose it would be practical to imagine conference partners sitting in a
circle.  N persons would be spread with 360 degrees / N apart.  If they
spoke out under an angle alpha, than their i'th neighbour would hear the
sound at an angle (alpha + i*360/N degrees).  And that angle would be used
in the opposite way as the tangent-formula above.

Sorry about the maths... I think it helps to clarify the approach though.
If you'd like me to, I could try to find an elegant and *practical* way of
modelling this with a simple matrix operation.  Let me know if you'd like
me to contribute that.  It'd mean that mixing inputs and forming outputs
from them is a nice operation with 2N inputs and 2N outputs with all the
above isolated into a series of multiplications and additions.  Of the sort
that would easily be met in hardware optimisations, if present.

I'm sure that hardware vendors won't mind adding a layer of luxoury models
for telephony... certainly not for business applications where they money
is available... but AFAIK there are no stereo switches yet.  Imagine a
good-quality codec (screwing ISDN, embracing OPUS) and the advantages of
stereo communication, we could have a good laugh at all those people who
still think 3000 Hz, audio-only and IPv4 define the VoIP arena.

Cheers,
-Rick

```

Join us at ClueCon 2011 Aug 9-11, 2011