audio_intro(3)
NAME
audio_intro, libaudio.a − audio library functions
SYNOPSIS
#include <multimedia/libaudio.h>
DESCRIPTION
libaudio.a provides a preliminary interface to many of the common operations necessary to access and manipulate audio files and devices. By embodying the specifics of file formats and device ioctl commands in library routines, programs may be insulated, in part, from future changes to the interface and data storage formats.
File Header
Audio files contain a header that has a magic number (identifying the file as an audio file) and fields that describe the encoding format used to store the audio data. Immediately following the header is a variable-length information field in which, for instance, ASCII annotation may be stored.
The format of the audio file header is compatible with a subset of the NeXT™ sound file header. Sun has adopted NeXT’s sound file header ideas to facilitate the transparent sharing of audio files in a networked environment. (The NeXT Nested and Indirect sound file types are not currently supported.)
In order that audio files may be successfully shared amongst multiple machine architectures, the header and data fields are written using big-endian byte-ordering. Though this means that byte-swapping may be necessary to read and write some data encodings on little-endian machines such as the Sun386i, this overhead is largely overwhelmed by all other signal manipulation operations. The benefits of transparent file access far outweigh the costs.
Routines to support the reading and writing of audio file headers are documented in the audio_filehdr(3) manual page. These routines convert between the file header format used for file interchange and the in-core audio header format used by most audio applications.
Audio Header
Audio data is described by an Audio_hdr structure that is similar, but not identical, to the audio file header. The audio header structure is described in the audio_hdr(3) manual page. The audio_misc(3) manual page describes routines that perform some simple transformations based on the contents of the audio header structure.
Audio Device Control
The audio(4) manual page describes the direct interface to the audio i/o device (/dev/audio) and the audio control pseudo-device (/dev/audioctl). For the most part, however, programs may use the routines documented in the audio_device(3) manual page to access and control the device.
Audio Data Conversions
The SPARCstation audio device operates on data that has been encoded in μ-law format, a quasi-logarithmic compression. Since most signal-processing algorithms perform arithmetic on linearly encoded data, it is convenient to be able to convert to and from a linear PCM representation. The audio_ulaw2linear(3) manual page describes macros that will perform these transformations.
SEE ALSO
audio_convert(3), audio_filehdr(3), audio_hdr(3), audio_misc(3), audio_ulaw2linear(3), audio(4)
NOTES
NeXT is a trademark of NeXT, Inc.
FUTURE DIRECTIONS
Although access to audio file headers are partly concealed in the file header routines, the data formats themselves are not properly hidden. Routines to demultiplex interleaved audio channels, and to transparently convert between data encodings, should be provided.
Access to many of the audio device status and control fields has been concealed in the audio device routines. As audio server technology emerges, these interfaces may remain stable while the underlying implementation changes. However, access to the data streams of the audio device should be similarly concealed.
WARNINGS
The manual pages, header files, and object library associated with /usr/demo/SOUND/libaudio.a are furnished on an as is basis as a preliminary interface to several useful audio data-processing capabilities. A future release of the operating system may redefine the syntax or semantics of some of the functions described herein.
SunOS 5.1/x86 — Last change: 30 Sep 1991