[openal] HRTF B-Format decoding

Chris Robinson chris.kcat at gmail.com
Sat Feb 14 16:08:53 EST 2015


Recent Git commits have added the ability to directly decode B-Format 
ambisonics using HRTF. This allows for retaining full 3D spatialization 
features provided by HRTF with the sound field stored by ambisonics. The 
relevant code generating the HRTF coefficients is here:

<http://repo.or.cz/w/openal-soft.git/blob/b4c9744d6ae8e768614ae911c69f49f7f341e94c:/Alc/hrtf.c#l316>

Some notes about it:

* It's first-order only, for now. In theory it could support second- and 
third-order, although there appears to be some scaling applied at 
different orders (the default coefficients as generated by ADT, 
<http://repo.or.cz/w/openal-soft.git/blob/b4c9744d6ae8e768614ae911c69f49f7f341e94c:/Alc/panning.c#l303>, 
seems to show the X/Y/Z coefficients are scaled up by about 1.2 when 
second-order coefficients are present, and by about 1.3 when third-order 
coefficients are present).

* The HRIR contributions are likely being calculated incorrectly. In 
particular, <http://www.blueripplesound.com/decoding> warns:

"It is tempting to build multichannel decoders by feeding simple virtual 
microphone responses in the directions of the various speakers. This 
does not work well, particularly for speaker layouts that are not regular."

but this is basically what it does, with each HRIR functioning as a 
speaker that's added to the overall output, and its position relative to 
the given B-Format channel direction determining how much it contributes 
(0 degrees = 100%, +/-45 degrees = 70%, +/-90 degrees = 0%, +/-135 
degrees = -70%, +/-180 degrees = -100%). The result sounds pretty good 
though, so perhaps I'm misunderstanding the warning? Or it isn't as good 
as it should be.

* There is an unlisted config option to make all mixing go to B-Format 
channels, which get decoded with HRTF for output ('hrtf-mode' set to 
'basic'). This option is off by default (so sound sources will mix 
directly with HRTF), and it's unlikely this will be exposed "publicly", 
but it's there to help test listening to the HRTF B-Format decode.


More information about the openal mailing list