This chapter describes the components of the digital audio system software: digital audio libraries, device drivers, and system-wide resources, and explains how these components interact. This chapter also describes other resources available to application developers, such as end-user audio tools, third-party audio software and sound libraries, and sample programs.
Figure 5-1 diagrams the interaction between an audio application and the audio libraries, the device drivers, the IRIX file system, the audio hardware, and the optional SCSI devices.
The digital audio libraries can be used separately or in combination. Each library is tailored to a particular set of tasks, as follows:
Audio Library | provides an API for configuring the audio system, managing audio I/O between the application program and the audio hardware, specifying attributes of digital audio data, and facilitating real-time programming. See Chapter 6, “Programming with the Audio Library.” |
Audio File Library | provides an API for reading and writing two standard digital audio file formats, AIFF and AIFF-C. See Chapter 7, “Programming with the Audio File Library.” |
CD Audio Library | provides an API for optional Silicon Graphics SCSI CD- ROM drives. The drive features a special mode that allows it to read audio CD format as well as CD-ROM format. See Chapter 8, “Programming with the CD Audio Library.” |
DAT Audio Library | provides an API for optional Silicon Graphics SCSI DAT drives. See Chapter 9, “Programming with the DAT Audio Library.” |
Audio applications share CPU resources with other processes, and they share audio resources with other audio applications running concurrently.
CPU resources are managed by the IRIX kernel, which gives some resources higher priority than others. Programming style can affect CPU usage, so to get the best performance from your application, use native data formats whenever possible (to avoid internal conversion), and free system resources as soon as they are no longer needed (see the individual chapters on each library for details). You can also request exclusive resources or upgrade the priority of your application by using the special IRIX real-time programming techniques described in “Real-time Programming Techniques for Audio” in Chapter 6.
Figure 5-2 shows how the IRIS audio utilities apanel, soundeditor, and soundfiler share the system's audio resources. Similarly, your audio application must share the audio resources with other audio applications running concurrently.
In Figure 5-2, three audio applications are running simultaneously. A recording engineer is using soundeditor to combine live input from a microphone with a prerecorded sound file stored on the disk. She is using apanel to monitor the input level and soundfiler to audition sound files through her headphones.
Note that while the input is selected from among three possible inputs, all of the outputs are added together and clipped to generate the final output, which is presented to all three outputs. This means that an audio application is responsible for determining if other audio applications are running concurrently, and limiting its output signal accordingly to avoid unnecessary clipping.
Figure 5-2 shows how the IRIS audio utilities apanel, soundeditor, and soundfiler share the system's audio resources.
The system-wide digital audio hardware and software settings are initialized to reasonable defaults when the system is powered on and whenever it is rebooted.
In Figure 5-2, the input rate and output rate are set at 44.1 kHz and remain fixed unless changed from apanel. soundfiler and soundeditor both allow the user to control the volume from apanel. soundfiler changes the input and output rates when needed, and soundeditor has the ability to change the rates but asks for confirmation before making any changes.
The values of the global audio settings are known collectively as the audio system state. Certain audio settings can be initialized and modified in software. The AL has routines for querying which elements of state can be controlled by software, and for getting and setting the values of the global state parameters. It is good programming practice to query for the existence of other audio processes before changing global settings.
Keep these guidelines in mind when writing audio applications:
Determine the availability of special features before attempting to use them.
Monitor the existence of concurrent audio applications and process output accordingly.
Manage system-wide settings that rely on personal preference, such as volume, through a global audio control program such as apanel; otherwise, query for the existence of other audio processes before changing settings such as data rates that can affect other applications.
Manage memory allocation for efficient use of system-wide resources.
This section describes additional tools that you may find helpful for developing audio applications.
End-user audio tools are provided for playing, recording, and manipulating digital audio signals. These audio tools were created using the digital audio libraries and therefore support AIFF and AIFF-C file formats. These tools are provided as part of the standard system software and feature online help.
See the Media Control Panels User's Guide for a complete description of these tools:
In addition, the system Toolchest contains a tool for performing confidence tests on system components, including the audio system, and the CD-ROM and DAT drives. See the owner's guide for your workstation for more information about confidence tests.
Source code examples are located online in /usr/people/4Dgifts/examples/dmedia, in directories labeled audio, cd+dat, dmplay, dmrecord, and midi. README files in these directories explain how to use and compile these programs. When a program from one of these directories is included in this guide, it is referred to as the 4Dgifts programname.c program. Because the online source for these programs can get updated more frequently than the printed version of this guide, you should consider the online source code as the most recent version if there is a discrepancy between them.
This section describes third-party audio software and libraries that are made available to the developer as part of the IRIS digital media libraries. Contact the companies directly for licensing and use rights.
Aware, Inc. scalable audio compression software is provided with the and can be accessed from Audio File Library routines or Compression Library routines. Two Aware codecs (compressor-decompressors) that provide ISO/MPEG and Aware MultiRate™ lossless and near-lossless compression are built into the Audio File Library as compression parameters, and additional Aware audio compression software can be accessed through other parameters in the Audio File and Compression Libraries. Aware also offers other licensable audio products and a CD-ROM library; see Appendix B, “Aware Scalable Audio Compression Software,” for details.
For more information about Aware products, contact Aware at:
Aware, Inc.
One Memorial Drive
Cambridge, MA 02142
Phone: (617) 577-1700
Fax: (617) 577-1710
Email: sales@aware.com
The Prosonus Sound Library, which is included with the end user media tools, contains more than 10 MB of professional quality music and sound samples. These files are located in /usr/lib/sounds/prosonus, and they represent a small subset of the music, sound effects, and instrument samples created by Prosonus. All included files are sampled at 44.1 kHz and stored in AIFF format. The complete Prosonus Sound Library is separately available on CD-ROM from Prosonus.
For more information about Prosonus products, contact Prosonus at:
Prosonus
11126 Weddington Street
North Hollywood, CA 91601
Phone: (800) 999-6191 or (818) 766-5221
Fax: (818) 766-6098
Prosonus files are license-free when used in private presentations. They may be shared via NFS with other Silicon Graphics computers but may not be copied to other systems. If you intend to ship the Prosonus files with a product intended for resale or broadcast, copyrights and royalties may apply. Please contact Prosonus for questions concerning licensing and resale of Prosonus files.
This section lists compiling and linking commands for digital audio and MIDI programs.
To compile an Audio Library program, enter:
cc –g ALsample.c -o ALsample –laudio
To compile an Audio File Library program, enter:
cc –g AFLsample.c -o AFLsample –laudiofile -laudioutil -lm
The Audio File Library also requires linking with libm.a, the math library, and with libaudioutil.so, the Audio Utility Library.
To compile a CD Audio Library program, enter:
cc –g CDsample.c -o CDsample –lcdaudio -lds -libmediad
The CD Audio Library also requires linking with libds.a, the SCSI device library and libmediad, the media library daemon.
To compile a DAT Audio Library program, enter:
cc –g DATsample.c -o DATsample –ldataudio
Programs making use of more than one of these libraries must link to all of the ones they use (the linking order is often specific):
cc –g prog.c -o prog –laudio -laudiofile -lcdaudio -lds -libmediad
Depending on the application you are writing, you may also have to link with other libraries such as the GL shared library, the math library, and the C shared library. You can use fast malloc() routines by including malloc.h and linking with libmalloc.a.
The audio and MIDI libraries are compatible with both ANSI C and the standard C. To compile code that is not ANSI-compliant, add –cckr to the command line.