Game Development Reference
In-Depth Information
for a source located at a specific location yield a pair of HRTFs. That's not too bad, but
that's only for one single source location. You need HRTFs for every location if you are
to emulate a 3D sound from any location. Obviously, generating HRTFs for every pos‐
sible relative location isn't practical, so HRTFs are typically derived from binaural re‐
cordings taken at many discrete locations to create a library, so to speak, of transfer
The HRTFs are then used to derive filters for a given sound you want to play back with
3D emulation. Two filters are required—one for each ear. And the HRTFs used to derive
those filters are those that correspond closest to the location of the 3D sound source
you're trying to emulate.
It is a lot of work to make all these recordings and derive the corresponding HRTFs.
Sometimes the recordings are made using a dummy, and sometimes real humans are
used. In either case, it is unlikely that you or your player resemble exactly the dummy
or human subject used to make the recordings and HRTFs. This means the synthesized
3D sound may only approximate the cues for any particular person.
A Simple Example
OpenAL allows you to simulate 3D sound via easy-to-use source and listener objects
with associated properties of each, such as position, velocity, and orientation, among
others. You need only associate the sound data to a source and set its properties, listener
position, velocity, and orientation. OpenAL will handle the rest for you. How good the
results sound depends on the OpenAL implementation you're using and the sound
hardware in use. OpenAL leaves implementation of things such as HRTFs to the hard‐
For demonstration purposes, we took the PlayStatic example provided in the Creative
Labs OpenAL SDK and modified it slightly to have the sound source move around the
listener. We've also included the Doppler effect to give the impression of the source
moving toward or away from the listener. The relevant code is as follows:
int main()
ALuint uiBuffer;
ALuint uiSource;
ALint iState;
// Initialize Framework
if (!ALFWInitOpenAL())
ALFWprintf("Failed to initialize OpenAL\n");
return 0;
Search Nedrilad ::

Custom Search