Important: Inside Macintosh: Sound is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.
Figures, Tables, and Listings
Chapter 1 Introduction to Sound on the Macintosh 1-1Figure 1-1 Basic sound capabilities on Macintosh computers 1-4
Figure 1-2 Enhanced sound capabilities on Macintosh computers 1-6
Figure 1-3 High quality sound capabilities on Macintosh computers 1-7
Figure 1-4 A sound component chain 1-8
Figure 1-5 A sound component chain with a DSP board 1-9
Figure 1-6 The Sound Out control panel 1-10
Figure 1-7 The relation of the Sound Manager to the audio hardware 1-11
Figure 1-8 Bypassing the command queue 1-13
Figure 1-9 Mixing multiple channels of sampled sound 1-14
Figure 1-10 The Sound In control panel 1-15
Figure 1-11 The Alert Sounds control panel 1-16
Figure 1-12 The sound recording dialog box 1-17
Table 1-1 AIFF and AIFF-C capabilities 1-19
Figure 1-13 The speech generation process 1-21
Figure 1-14 The Speech Manager and multiple voices 1-21
Figure 1-15 An icon for a Finder sound 1-23
Figure 1-16 A sound in the Scrapbook 1-24
Listing 1-1 Playing a sound resource with SndPlay 1-25
Listing 1-2 Playing a sound file with SndStartFilePlay 1-26
Listing 1-3 Determining whether sound recording equipment is available 1-27
Listing 1-4 Recording through the sound recording dialog box 1-28
Listing 1-5 Recording a sound resource 1-29
Listing 1-6 Recording a sound file 1-31
Listing 1-7 Checking for speech generation capabilities 1-31
Listing 1-8 Using SpeakString to generate speech from a string 1-32
Listing 1-9 Generating speech synchronously 1-33
Listing 1-10 Stopping speech generated by SpeakString 1-34
Figure 2-1 The position of the Sound Manager 2-6
Figure 2-2 A graph of a wave table 2-9
Figure 2-3 Interleaving stereo sample points 2-11
Table 2-1 Sample rates 2-16
Listing 2-1 Creating a sound channel 2-20
Listing 2-2 Reinitializing a sound channel 2-24
Listing 2-3 Disposing of memory associated with a sound channel 2-25
Listing 2-4 Halving the frequency of a sampled sound 2-26
Listing 2-5 Changing the amplitude of a sound channel 2-27
Listing 2-6 Getting the amplitude of a sound in progress 2-28
Listing 2-7 Adding a channel to a group of channels to be synchronized 2-30
Listing 2-8 Setting left and right volumes 2-32
Listing 2-9 Determining if stereo capability is available 2-34
Listing 2-10 Determining if the enhanced Sound Manager is present 2-35
Listing 2-11 Testing for multichannel play capability 2-36
Listing 2-12 Testing for play-from-disk capability 2-37
Listing 2-13 Determining whether a sound channel is paused 2-39
Listing 2-14 Determining the number of allocated sound channels 2-40
Listing 2-15 Using the freqDurationCmd command 2-42
Table 2-2 Frequencies expressed as MIDI note values 2-43
Listing 2-16 Installing a sampled sound as a voice in a channel 2-44
Listing 2-17 Looping an entire sampled sound 2-45
Listing 2-18 Issuing a callback command 2-48
Listing 2-19 Defining a callback procedure 2-48
Listing 2-20 Checking whether a callback procedure has executed 2-49
Listing 2-21 Stopping a sound that is playing asynchronously 2-50
Listing 2-22 Starting an asynchronous sound play 2-50
Listing 2-23 Defining a completion routine 2-52
Listing 2-24 Defining a data structure to track many sound channels 2-54
Listing 2-25 Marking a channel for disposal 2-55
Listing 2-26 Disposing of channels that have been marked for disposal 2-55
Listing 2-27 Playing a sound resource 2-57
Listing 2-28 Obtaining the offset in bytes to a sound header 2-58
Listing 2-29 Converting an offset to a sound header into a pointer to a sound header 2-60
Listing 2-30 Playing a sound using the bufferCmd command 2-62
Listing 2-31 Finding a chunk in a sound file 2-63
Listing 2-32 Loading a chunk from a sound file 2-65
Listing 2-33 Compressing audio data 2-67
Listing 2-34 Setting up double buffers 2-70
Listing 2-35 Defining a doubleback procedure 2-73
Figure 2-4 The structure of 'snd ' resources 2-74
Figure 2-5 The location of the data offset bit 2-75
Listing 2-36 A format 1 'snd ' resource 2-76
Listing 2-37 A format 1 'snd ' resource containing sampled-sound data 2-77
Listing 2-38 An 'snd ' resource containing compressed sound data 2-78
Listing 2-39 A resource specification 2-79
Listing 2-40 A resource specification for the Simple Beep 2-79
Listing 2-41 A format 2 'snd ' resource 2-81
Figure 2-6 The general structure of a chunk 2-83
Figure 2-7 A sample AIFF-C file 2-88
Figure 2-8 The 'snd ' resource type 2-155
Figure 2-9 The sound resource header 2-156
Chapter 3 Sound Input Manager 3-1
Listing 3-1 Recording directly from a sound input device 3-7
Listing 3-2 Determining the name of a sound input device 3-12
Listing 3-3 Determining some sound input device settings 3-12
Figure 3-1 An example of the csParam field for a Status request 3-14
Figure 3-2 An example of the csParam field for a Control request 3-14
Table 3-1 The sampled sound header format used by SetupSndHeader 3-45
Figure 4-1 The speech generation process 4-4
Figure 4-2 The Speech Manager and multiple voices 4-5
Figure 4-3 MIDI note values and corresponding piano keys 4-7
Figure 4-4 An example of pitch range for a voice 4-8
Listing 4-1 Checking for speech generation capabilities 4-12
Listing 4-2 Speaking text with a speech channel 4-13
Listing 4-3 Getting a description of a voice 4-15
Listing 4-4 Changing the speech rate and pitch 4-16
Listing 4-5 Pausing and continuing speech production 4-18
Listing 4-6 Setting up a speech channel for callbacks 4-21
Listing 4-7 Installing a word callback procedure 4-21
Listing 4-8 A typical word callback procedure 4-22
Table 4-1 The embedded command syntax structure 4-25
Table 4-2 Embedded speech commands 4-26
Table 4-3 American English phoneme symbols 4-33
Table 4-4 Prosodic control symbols 4-34
Table 4-5 Effect of punctuation marks on English-language synthesizers 4-35
Listing 4-9 Installing a pronunciation dictionary resource into a speech channel 4-37
Listing 4-10 A sample pronunciation dictionary resource 4-38
Figure 4-5 Format of a pronunciation dictionary resource 4-90
Figure 4-6 Format of a dictionary entry in a dictionary resource 4-92
Figure 4-7 Format of a dictionary entry field 4-93
Chapter 5 Sound Components 5-1
Figure 5-1 The component-based sound architecture 5-5
Figure 5-2 A component chain for audio hardware that can convert sample rates 5-5
Figure 5-3 Mixing multiple channels of sound 5-6
Figure 5-4 A sound output device component that can mix sound channels 5-7
Listing 5-1 Rez input for a component resource 5-11
Listing 5-2 Handling Component Manager selectors 5-14
Listing 5-3 Finding the address of a component-defined routine 5-14
Listing 5-4 Initializing an output device 5-17
Listing 5-5 Getting sound component information 5-19
Chapter 6 Audio Components 6-1
Figure 6-1 The Apple AudioVision 14 Display 6-4
Figure 6-2 The Volumes control panel for the Apple AudioVision 14 Display 6-4