The Audio Toolbox framework provides a set of services that applications can use for audio processing:
AudioConverter.h
AudioFormat.h
AudioFile.h
AUGraph.h
In Java, these services are provided in the com.apple.audio.toolbox package.
Audio Converter
Audio Format
Audio File
AUGraph
Music Player and Music Sequence
Audio Converter provides format conversion services. When encoding or decoding audio data, Audio Converter should be utilized, as it allows for sample rate conversions, interleaving and deinterleaving of audio streams, floating-point-to-integer and integer-to-floating-point conversions, and bit rate conversions. Also, the API handles channel reordering, as well as converting between PCM and compressed formats. When encoding or decoding an audio stream, use of Audio Converter is strongly recommended over the direct use of an audio codec, since optimizations are in place to provided for optimal conversions.
The Audio Format API is provided to help handle information
about different audio formats. It is able to inspect AudioStreamBasicDescription instances
and provide more information about a particular format’s parameters.
This API also can derive information from AudioChannelLayout instances,
including a description of the channels present in the instance,
and the ordering of the channels. Finally, Audio Format can provide
information about the encoders and decoders available on the system.
Audio File is a system with which audio files may be created, opened, modified, and saved. Besides these operations, it also allows for discovery of global properties, including:
File types that can be read.
File types that can be written.
A name for a file type.
Stream formats that can be read.
All file extensions that can be read.
File extensions for a file type.
The AUGraph is a high-level representation of a set of Audio Units, along with the connections between them. These APIs may be used to construct arbitrary signal paths through which audio may be processed, that is, a modular routing system. The APIs deal with large numbers of Audio Units and their relationships to one another.
AUGraphs provide the following services:
Real-time routing changes that allow for connections to be created and broken while audio is being processed.
Maintaining representation even when Audio Units are not instantiated.
The head of a graph is always an output unit, which may save the processed audio stream to disk, into memory, or as sound out. Starting a graph entails “pulling” on the head unit (provided for by API), which will, in turn, pull on the next unit in the graph. The contents of a graph may be saved output and saved for later use.
The Music Player and Music Sequence APIs are used in tandem to sequence various events. Events can range from the changing of an audio unit's parameters to sending a MIDI endpoint a message. Standard MIDI files are played back using the Music Player API, particularly using the provided functions (see Reading in an SMF section). Similarly, you can save incoming MIDI data to a music sequence and then save the sequence as a standard MIDI file.There are three pieces in the Music Player API: players, sequences, and tracks.Players are assigned to a sequence, and trigger the sequence to start and stop. The relation between a player and a sequence is one-to-one, meaning that each player may only have one sequence assigned to it, and vice versa. Players also keep track of the current playback time in the sequence, and allow the playback time to be set. Finally, a scalar can be applied to a player, which will alter the tempo of the assigned sequence by that scalar.A sequence is a collection of tracks. A track is collection of events targeted at either a MIDI endpoint, an audio unit, or a callback. A sequence may contain an arbitrary number of tracks, created as needed. Each sequence also contains one special track, the tempo track. This track measures out the playback rate, in beats-per-minute (bpm). Adding tempo events to a tempo track will change the rate at which events occur from that point on, or until the next tempo event occurs.
When recording MIDI events for saving to disk, the incoming MIDI data needs to be parsed and placed into the sequence, which then can be saved as a standard MIDI file, for later use.
Last updated: 2004-03-25