Chapter 17 - Audio Library
The Nintendo 64 Audio Library is a lightweight library of functions. It provides game developers with the ability to interactively synthesize and manipulate audio on the Nintendo 64. It provides support for both sampled sound playback and wavetable synthesis. This is accomplished with four software objects: the Sound Player, the Sequence Player, the Synthesis Driver, and the Audio Synthesis microcode. These are shown in Figure 17-1.
-
The Sound Player is useful for the playback of single sampling sound effect or streaming audio. It is capable of playing back wither ADPCM compressed sounds, or uncompressed 16 bit sound.
-
The Sequence Player can exist in either of two types. The first type plays back Type 0 MIDI sequence files and the second type plays back a format of compressed MIDI unique to the Nintendo 64. In both cases, the sequence player handles sequence, instrument bank, and synthesizer resource allocation, sequence interpretation, and MIDI message scheduling.
Note: Both the Sequence Player and the Sound Player are clients of the Synthesis Driver. The Driver can support an arbitrary number of clients, including multiple Sound and Sequence Players.
-
The Synthesis Driver is responsible for creating audio Command Lists, which are packaged into tasks by the Application program and passed on to the Audio Synthesis Microcode. It allows Driver clients to assign wave tables to synthesizer voices, and control the playback parameters.
-
The Audio Synthesis Microcode processes the tasks passed to it by the application and synthesizes stereo 16- bit samples, which the application then passes to the Audio DACs.
This chapter contains descriptions of the Sound Player, Sequence Player, and Synthesis Driver APIs . Many application programmers will be satisfied with the interfaces provided by the Sound and Sequence Players. Most of the Synthesis Driver API is intended for programmers who want to create their own players (see Section 17.5 "Writing Your Own Player" for more information); however, all programmers should have a better understanding about certain functions essential for the creation of audio Command Lists.
-
Figure 17-1 Audio Software Architecture
-
The following sections outline the data structures and API calls that are necessary to make use of the audio library. See Chapter 20 "Using the Audio Tools" for more details about some of the data structures. The data structure definitions and function prototypes for the calls described are in the include file libaudio.h, which is part of the software release. Also included as a part of the software release are reference (man) pages for each of the function calls.
-
17.1 Generating Audio Output
-
17.2 Sampled Sound Playback
-
17.2.1 Representing Sound
17.2.2 Playing Sound
-
17.3 Sequenced Sound Playback
-
17.3.1 Representing the Sequence
17.3.2 Representing Instruments
17.3.3 Playing Sequences
17.3.4 Loops in Sequence Players
17.3.5 Controllers in Sequence Players
-
17.4 The Synthesis Driver
-
17.4.1 Initializing the Driver
17.4.2 Building and Executing Command Lists
17.4.3 Synthesis Driver Sound Data Callbacks
17.4.4 Assigning Players to the Driver
17.4.5 Allocating and Controlling Voices
17.4.6 Effects and Effect Busses
17.4.7 Creating Your Own Effects
17.4.8 Parameter Description
17.4.9 Summary of Driver Functions
-
17.5 Writing Your Own Player
-
17.5.1 Initializing the Player
17.5.2 Implementing a Voice Handler
-
17.6 Implementing Vibrato and Tremolo
-
17.6.1 The initOsc Routine
17.6.2 The updateOsc routine
17.6.3 The stopOsc routine