[openal] stereo separation issue with a stereo source

Chris Robinson chris.kcat at gmail.com
Sat Feb 7 12:43:08 EST 2015

On 02/06/2015 05:37 AM, Lubomir I. Ivanov wrote:
> some would argue about the HRTF topic, but i would agree.
> question is why does openal-soft downmixes a 2 channel mix to
> accommodate a virtual configuration or a headphone setup where there
> is none and while all my audio related playback and recording software
> (including winamp, cooledit, mediaplayerclassic etc.) doesn't by
> default.

OpenAL Soft doesn't downmix a stereo stream. What it does is, basically, 
pan each channel of a multi-channel input buffer separately, to be 
positioned around a virtual listener, as if that channel was emanating 
from that position regardless if a speaker is actually present there or not.

Part of this is required functionality (e.g. if you have a quad setup 
and try to play a 7.1 buffer, you need to keep the front-center and side 
channels), and part of it is a nicety (e.g. if you have headphones/HRTF, 
a 7.1 buffer will play filtered to sound as the channels are coming from 
the front, side, and back).

The way OpenAL Soft does non-HRTF panning causes other nearby speakers 
to play some of the sound as well, however the gains are appropriately 
balanced so that the sound is "focused" in the direction it's panned to. 
Previously OpenAL Soft used a basic panpot method between the two 
closest speakers to the sound's angle, but that's not the greatest 
method (especially if you want to add true 3D speaker positions) and 
recently switched to third-order ambisonics.

LFE is the only channel that's mapped directly to a specific output 
speaker, since it has no actual position. It only includes an 
omni-directional low-frequency signal intended for a speaker designed to 
play only low frequencies.

> the current setup (quadro 2 front / 2 back).
> the driver panel it's in the lines of this:
> http://i.stack.imgur.com/IVPSN.jpg
> two observations after testing a little:
> - for "stereo" is selected openal-soft uses direct channels
> - for "quadro" the downmix in openal-soft is in action
> - haven't tested 5.1, 7.1
> (the sub-options for quadro don't seem to matter)
> but like i said above, no other software does that and the front
> speakers simply reproduce the direct channels stereo and same is
> mirrored in the back, without any further virtualization. this is to
> my knowledge what is called channel doubling.

OpenAL Soft doesn't normally use a speaker-matching/doubling method. As 
mentioned above it virtualizes the channels, so that they sound as if 
they play from as close as possible to where they should play from, 
regardless if there's a physical speaker there or not.

I did at one point try to do speaker matching when possible and only 
virtualize them when needed, but I found that the resulting volume was 
unbalanced -- a sound playing directly from a single speaker would not 
have the same loudness as one that was panned (even if it was panned to 
that speaker). See the commit message for f05a2b86cd59bd3827ce.

>> If you're using stereo speakers, check that they're not configured or
>> detected as headphones by OpenAL Soft.
> alsoft.* seems to be missing.
> any other way to check what the library uses?

Set the environment variable ALSOFT_LOGLEVEL to 3 before running the 
app, to make the lib print out a bunch of info to stderr. If you want to 
write it to a file instead of standard output, set ALSOFT_LOGFILE (if 
you set a relative filename, it will be relative to the app's CWD when 
the lib initializes).

> i see. well, in DSP terms stereo field manipulation like channel angle
> (phase rotation as they call it) and width (by adjusting the "side" or
> left - right difference) it's quite trivial.
> it should not matter if a previous downmix has happened or if we are
> dealing with direct channels.

It doesn't quite work that way with OpenAL Soft. What "direct channels" 
means is fairly literal... the front-left buffer channel is mapped 
directly to the front-left output channel if it exists, otherwise it's 
dropped. It does still otherwise get run through the source's filters 
and effect sends if they're set, but it doesn't manipulate how input 
channels are mapped to the output beyond matching them by label.

It is possible to widen and narrow a stereo field, especially if you 
convert it to a mid-side format, but that would not be direct channel 

More information about the openal mailing list