Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


OpenAL Explained

by Dave Phillips
10/13/2000

Related Articles:

What Is This 3D Audio Business?

OpenAL Applications: The User's View

OpenAL Development: The Programmer's View


Previous Features

More from the Linux DevCenter

OpenAL, the Open Audio Library, is an initiative from Creative Labs and Loki Entertainment designed to provide a cross-platform open source solution for programming 2D and 3D audio. It is licensed under the GNU Lesser General Public License (LGPL), with current implementations supporting Windows, the Macintosh OS, Linux, FreeBSD, OS/2, and BeOS. The OpenAL API has been designed for portability of applications between supported platforms, particularly games and other multimedia applications using OpenGL for 3D graphics.

As its name implies, OpenAL is analogous in many ways to SGI's OpenGL, a widely implemented standard for specifying high-quality 3D graphics (see Chris Halsall's article for more information regarding OpenGL). The analogy extends far beyond the name: Many of the design considerations for OpenAL are derived from similar considerations for the visual effects possible from OpenGL, particularly with regard to movement in three dimensions and proximity-dependent texture variance. Because the OpenAL API is so similar to OpenGL, programmers employing OpenGL for graphics can more easily bind sonic activity to visuals, leading to exciting possibilities for games and other graphics-intensive applications.

As with OpenGL, a little OpenAL code does a lot. Developers can simply place their sounds into a scene and let OpenAL render the changes of the sounds relative to the positional changes of the listener.

The programming interface is hardware-independent. It can be deployed on virtually any soundcard usable on the supported platforms, though of course its potential will be most fully realized on cards with multichannel audio output. The API is a relatively higher-level interface that provides a communication protocol with the sound card driver. For Linux users it should make no difference whether the card driver comes from the kernel sources, ALSA, or OSS/Linux.

The OpenAL library is designed to act in coordination with the low-level routines of the driver. At this time the API and library focus only on PCM audio, although it is possible that future revisions will address CD audio and hardware MIDI synthesis.

OpenAL also follows recommendations put forth by the Interactive Audio Special Interest Group (IASIG). The current API has been written to accommodate at least the following IASIG Level 1 guidelines:

OpenAL Resources On-line

The author would like to thank Joseph I. Valenzuela, Michael Vance, Bernd Kreimeier, Fotis Hadginikos, and Derrick Story for their vast assistance. This series of articles could not have been written without their help.

The IASIG Level 2 guidelines specify a set of environment parameters for reverberation. Work has already begun to incorporate those parameters into the OpenAL API.

The current OpenAL API reference can be found in the openal/docs directory, but it is in SGML format. You will need the DocBook tools to compile the API documentation into readable HTML. The reference documentation is also available on-line here. I should emphasize that the documentation is directed only to developers at this time.

As an open source project with corporate blessings, OpenAL seems assured of widespread implementation. It offers an open source solution to the problem of highly portable cross-platform support for 3D audio in games and other multimedia applications, making it of great interest to developers and end-users alike. Even while the 1.0 specification is being ratified, some developers are already employing OpenAL's services.

OpenAL is not without its contenders, but those solutions are proprietary or locked into a single architecture. OpenAL is already a working multi-platform interface for audio (especially 3D audio) services, and with hardware acceleration, OpenAL could revolutionize computer audio in the same way as OpenGL revolutionized computer graphics, an exciting prospect indeed.

As a final reminder, please note that OpenAL is a community effort, and community involvement is encouraged. See the OpenAL Web site for complete details on getting involved in the project.

In the last article we will take a deeper look at the internals of the API, but first we'll discuss 3D audio and then see what real-world applications have already employed the OpenAL specification.

Next: What Is This 3D Audio Business?

Dave Phillips maintains the Linux Music & Sound Applications Web site and has been a performing musician for more than 30 years.


Discuss this article in the O'Reilly Network Linux Forum.

Return to the Linux DevCenter.

 

Copyright © 2009 O'Reilly Media, Inc.