[openal] A couple questions about OpenALSoft
chris.kcat at gmail.com
Sun Feb 23 00:06:00 EST 2014
On 02/22/2014 06:45 PM, Austin Hicks wrote:
> What's the possibility of getting OpenALSoft HRTEF to work at 192000
> HZ? I know that the difference is probably imperceptible, but my audio
> equipment claims to support it, and it'd be nice if this just works
> without changing settings. Is there a reason that makehrtf limits to
> 96khz? I'm assuming I can't just disable this limit and expect it to
> work. Also, looks like this only hits mmdevapi backend-the older ones
> seem to not go over 96khz.
The biggest issue is processing time. At 44~48Khz it uses a 32-point FIR
filter for each output sample (per channel) to properly filter it. At
192Khz, you'd need a 128-point filter to get the same result. So not
only would you need 4 times as many points, you'd need to do it 4 times
more often (128 taps 192000 times a second instead of 32 taps 48000
times a second).
Given the limits of human hearing and the filter source, it's probably
just as good to mix with HRTF at 48khz and then do a fast, high-quality
4x resampling to 192khz.
That said, I'm not sure it shouldn't technically be possible. There
could, however, be issues with integer overflow and floating-point
accuracy when dealing with large samples rates. It would need testing.
> Secondly, how do I make proper use of buffers that are more than 2
> channels? I'm not sure how to map samples from their desired channel to
> the expected data format, and no information seems available anywhere on
> this. Does anyone know which order to put the channels in before
The order is like WFX.
mono - mono
stereo - front left, front right
rear - back left, back right
quad - front left, front right, back left, back right
5.1 surround - front left, front right, front center, lfe, back left,
6.1 surround - front left, front right, front center, lfe, back center,
side left, side right
7.1 surround - front left, front right, front center, lfe, back left,
back right, side left, side right
> On a sidenote, does anyone know how to extract the order from audio
> files, or if there is a standard order that audio files use?
> Camlorn_audio, my python/C++/probably other language bindings can do
> stereo, but it'd be nice to get them automatically doing other
> multichannel formats without extra steps by the user.
Different audio formats specify their own ordering standards. Ogg
Vorbis, for instance, specifies this:
For wav files it's a bit more complicated since the format is just a
container; the actual audio can be in any number of formats.
WAVE_FORMAT_PCM (type 0x0001), for instance, doesn't really specify
anything, and WAVE_FORMAT_EXTENSIBLE (type 0xfffe) does specify an
ordering with its channel mask field (basically the channels are ordered
by the lowest set bit first to the highest last).
For other formats, you'll need to find their specification. Anything
more than two channels is highly format-dependent.
More information about the openal