libao documentation | libao version 0.8.5 - 20040312

# libao Drivers

Libao supports both live output drivers and file output drivers. Live output drivers send audio data to sound cards and sound daemons. File output drivers write audio to disk using a particular file format (such as WAV, AU, etc.). You must invoke the ao_open_????() function that corresponds to the type of driver you are using, but otherwise live and file drivers are treated identically in libao.

## Live Output Drivers

### null

Null driver. This is just a test device which does not write the audio data anywhere.

Option keys:

- "debug" - Print the number of bytes written to the device to stderr when the device is closed. The option value is ignored.

### alsa

Advanced Linux Sound Architecture. This driver borrows some code from Jaroslav Kysela's <perex@suse.cz> GPLed aplay that is included with the alsa-util distribution. It defaults to device 0 on card 0. Because of the way ALSA reads data, this driver packs sound from successive calls into a fixed size buffer (defaults to 32kB) and sends it to the card. Note that this driver only works with ALSA 0.5.x. You should use the `alsa09` driver for the ALSA 0.9.x or 1.0.x series.

Option keys:

- "card" - Sound card number.
- "dev" - Device number on sound card.
- "buf_size" - Override the internal buffer size (in bytes). Experiment with this if the sound skips. Default is 32768.

### alsa09

Advanced Linux Sound Architecture, version 0.9.x and 1.0.x API. This is essentially the alsa driver modified to use the newer API.

Option keys:

- "dev" - Device name of sound card. Defaults to "default".
- "buf_time" - Override the hardward buffer size (in milliseconds).
- "period_time" - Override the size of periods ALSA uses.
- "use_mmap" - Set to "1" to enable the use of memory-mapped I/O API.

### esd

ESounD audio driver. This sound daemon is used on some Linux systems. It permits multiple programs to play sound simultaneously and sound to be sent to networked computers.

Option keys:

- "host" - The hostname where esd is running. By default sound is played on the local host. A port number can be specified after a colon, as in "whizbang.com:555".

### irix

IRIX audio driver. This was inherited from the original libao, but has not been tested. Use at your own risk. (Better yet, fix it! I don't have access to an IRIX system.)

Option keys: None.

### oss

Open Sound System driver. This is the audio system for Linux and FreeBSD as well as some other UNIX-like systems.

Option keys:

- "dsp" - The dsp device. By default, the driver tries "/dev/sound/dsp", followed by "/dev/dsp".

### sun

Sun audio driver. This is the audio system for NetBSD, OpenBSD, and Solaris.

Option keys:

- "dev" - The audio device for the sound card. By default, the driver tries "/dev/audio".

### aixs

AIX sound driver. According to the author, "tested on AIX 5.1 with the Crystal chipsets only (found as internal audio in the 7043-140 and on the MCA adapter DFE5 (7-6)), but it should work with other AIX releases and the ACPA also."

Option keys:

- "dev" - The audio device for the sound card. By default, the driver tries "/dev/baud0/1" (device for MCA machines with the Crystal chipset). Other possible devices are "/dev/paud0/1" for PCI machines with the Crystal chipset, and "/dev/acpa0/1" for MCA machines with the ACPA.

## File Output Drivers

### au

Sun audio file driver. Writes a .au file from audio output. This driver can write usable data to unseekable files (like standard out), which the wav driver cannot do.

Option keys: None.

### raw

Raw sample driver. Writes the sound to disk in uncompressed, headerless form using the byte order specified.

Option keys:

- "byteorder" - Byte order used in the output. Use "native" for native machine byte order, "big" for big-endian order, and "little" for little-endian order. By default this is "native".

### wav

Windows sound file output. Because of the way WAV files are structured, this driver cannot correct files unless the target file is seekable. Writing WAVs to stdout will result in broken files. Use either the raw or the au driver instead.

Option keys: None.

## Default Driver Detection

In the absence of configuration files to explicit identify a default driver, the library will try to detect a suitable default driver. It does this by testing every available live output driver (using ao_plugin_test()) and finding the driver with the highest priority (see the ao_info struct) that works. Drivers with priority 0, such as the null and file output drivers, are never selected as the default.

The ranking system currently used is:

Priority | Drivers
--- | ---
30 | alsa, alsa09
20 | oss, irix, sun
10 | esd,arts
0 | null, all file output

Clearly, any ranking scheme will fail to make everybody happy. For such cases, the configuration files can be easily used to define an appropriate default output device

copyright © 2001-2003 Stan Seibert | xiph.org volsung@xiph.org
libao documentation | libao version 0.8.5 - 20040312