store samples for playback, we have to agree on a format: • Data type (signed integer is typical) • Data size (16 bits is typical) • Sample rate (44.1 kHz for music, much less for voice) • Number of channels (1 = mono, 2 = stereo, etc.) • Interleaved or non-interleaved We won’t even bother talking about compression here.
a brief sound clip or effect? • System Audio Services Need to play a longer audio file, stream from a network, or access the iPod Library? • AVFoundation (specifically, AVPlayer) Need to synchronize multiple audio files? • Audio Queue Services Need access to uncompressed samples (e.g., for custom effects or on-the-fly sound generation)? • Audio Units
on one of several roles: • Input or output device (microphone, speaker) • Mixer (blend 2+ streams of audio together) • Effect (distort, echo, match tempo, pitch correction) Wired together to make Audio Unit Graphs Comprise a plug-in architecture on Mac OS. Less so on iOS.
and add nodes for them. 2. Open the graph to create the nodes and their corresponding units. 3. Make connections between nodes. 4. Configure render callbacks for any sources of samples that aren’t other nodes in the graph. 5. Initialize the graph to finalize connections and make sure formats are mutually-compatible. Getting up and running
and add nodes for them. 2. Open the graph to create the nodes and their corresponding units. 3. Make connections between nodes. 4. Configure render callbacks for any sources of samples that aren’t other nodes in the graph. 5. Initialize the graph to finalize connections and make sure formats are mutually-compatible. Getting up and running
files (MP3, AAC, etc). Problem: Audio Units lack support for handling compressed formats. Solution: Extended Audio File Services, whose sole purpose is to efficiently decompress audio files into ready-to-consume samples. Playing compressed audio files
basic wrapper for reading and writing audio data on iOS http://alexbw.github.com/novocaine/ The Amazing Audio Engine: a much more sophisticated object-oriented Audio Unit wrapper (coming real soon now) http://theamazingaudioengine.com WWDC Videos: Not just Audio Units! Also Session Services and all of AVFoundation Available in iTunesU to registered developers