HRTF support
Chris Robinson <[email protected]>
| Newsgroups | gmane.comp.lib.openal.devel,gmane.comp.lib.openal |
|---|---|
| Message-ID | <[email protected]> |
It's been often asked about, so here's an announcement for the interested. I just pushed some changes to Git/SVN that adds proper HRTF support to OpenAL Soft. It uses data based on the KEMAR HRTF measurements (compact version), found here: http://sound.media.mit.edu/resources/KEMAR.html The data was processed so it could be compiled directly into the lib[1]. It's handled in such a way that (hopefully) allows the data to be placed in read- only, shareable memory, so the physical memory used by it should be mininal. HRTF must be enabled in the config file, and only works with 44100hz stereo output (it automatically disables if this is not the case). It currently only works on mono sources[2], and the cf_level and head_dampen config options are ignored while it's active[3]. The future may see improvements to it, such as detecting headphone output vs normal stereo, and enabling it by default when appropriate. It can also be improved by merging the direct path low-pass filter, so both of them can apply at once. Try it out and let me know how it works. If you have any recommendations for improvemnts, I'd like to hear them, too. [1] For the curious, it was done using this rather hacky tool: http://kcat.strangesoft.net/dumper.c Compile it, change to the directory where compact.zip was extracted, and run it. It should then silently create hrtf_tables.inc, which is included by hrtf.c. [2] This may be expanded in the future, however the actual filter isn't exactly cheap in either memory and CPU use... approx. 1536 bytes * max input channels * allocated sources, and it uses a 128-tap FIR filter per output channel, per input channel. It's doable, it just may have a cost. If you want, you can check out mplayer (the Linux one). It's OpenAL output uses separate sources for each channel, so a multi-channel audio file gets separated into multiple mono sources placed around the listener, which are each filtered accordingly. It works, and gives a neat effect for multi-channel audio. [3] Because of the cf_level option being ignored, multi-channel sounds may again exhibit a super-stereo effect when using headphones. This should be dealt with once HRTF is applied to multi-channel sources.