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.
Chapter 1 - Introduction to Sound on the Macintosh
This chapter provides an introduction to managing sound on Macintosh computers. It's intended to help you quickly get started integrating sound into your application. This chapter introduces the concepts described in detail throughout the rest of this book and provides source code examples that show you how to use the most basic sound-related capabilities of Macintosh computers. These examples use the Sound Manager to play sounds, the Sound Input Manager to record sounds, and the Speech Manager to convert text strings into spoken words.Even if your application is not specifically concerned with creating or playing sounds, you can often improve your application at very little programming expense by using these system software services to integrate sound or speech into its user interface. For example, you might use the techniques described in this chapter to
If you want to use sound in these simple ways, this chapter will probably provide all the information you need. The Sound Manager, Sound Input Manager, and Speech Manager provide high-level routines that make it very easy to play or record sounds without knowing very much about how sounds are stored or produced electronically.
- play a sound to alert the user that a lengthy spreadsheet calculation is completed
- provide voice annotations for a word-processing document
- read aloud the text string that is displayed in a dialog box
If, on the other hand, you are writing an application that is primarily concerned with sound, you should read this chapter and some of the remaining chapters in this book. You also need to read those chapters if you want to play computer-generated tones without using sound resources or sound files, play sounds asynchronously, play sounds at different pitches, record sounds without using the standard sound recording interface, or customize the quality of speech output to make it easier to understand.
To benefit most from this chapter, you should already be familiar with simple resource and file management, discussed in the chapters "Resource Manager" in Inside Macintosh: More Macintosh Toolbox and "Introduction to File Management" in Inside Macintosh: Files. In particular, this chapter does not explain how to open or close resource or data files, although it does provide source code examples that demonstrate how to play a sound from, or record a sound to, a resource or data file that is already open.
This chapter begins with an overview of sound on Macintosh computers. It describes the audio capabilities available on all Macintosh computers and some of the capabilities achievable by adding additional hardware and software to Macintosh computers. Then this chapter describes how you can use the available system software routines to
For your convenience, this chapter also includes a reference section containing complete descriptions of the routines used to perform these tasks, and both Pascal and C language summaries. All of the routines in the reference section of this chapter are also in the reference sections of the chapter that describes the manager they are part of.
- play the system alert sound
- play sounds stored as resources
- play sampled sounds stored in sound files
- determine whether a particular Macintosh computer is capable of recording sounds
- record sounds into resources
- record sounds into sound files
- convert text strings into spoken words
Chapter Contents
- About Sound on Macintosh Computers
- Sound Capabilities
- Sound Production
- Sound Recording
- Sound Resources
- Sound Files
- Speech Generation
- The User Interface for Sound
- Using Sound on Macintosh Computers
- Producing an Alert Sound
- Playing a Sound Resource
- Playing a Sound File
- Checking For Sound-Recording Equipment
- Recording a Sound Resource
- Recording a Sound File
- Checking For Speech Capabilities
- Generating Speech From a String
- Sound Reference
- Routines
- Playing Sounds
- Recording Sounds
- Generating and Stopping Speech
- Summary of Sound
- Pascal Summary
- Constants
- Routines
- C Summary
- Constants
- Routines
- Result Codes