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.
Using the Speech Manager
You can use the Speech Manager simply to convert Pascal-style strings into speech. This simple technique is described in the chapter "Introduction to Sound on the Macintosh" in this book. This section shows how you can take advantage of more features of the Speech Manager.Before you can generate synthetic speech on a Macintosh computer, you need to make sure that the Speech Manager is installed. "Checking for Speech Manager Capabilities" beginning on page 4-12 shows how to check for the availability of the Speech Manager. It also demonstrates how to use the
SpeakString
function to generate synthesized speech in the most straightforward way.To take advantage of most of the Speech Manager's features, you must allocate a speech channel to pass to Speech Manager functions and dispose of the speech channel when you are finished using it. "Creating, Using, and Disposing of a Speech Channel" beginning on page 4-13 demonstrates how you do this and shows how you can use the
SpeakText
function to start speech generation from a buffer of text. Some applications permit users to choose a voice from those available to be used for speech generation. TheCountVoices
,GetIndVoice
, andGetVoiceDescription
functions support this capability. "Working With Different Voices" beginning on page 4-14 shows how you can use these functions to choose among available voices.You can also use the
SpeakText
function to customize some attributes of speech generation. "Adjusting Speech Attributes" beginning on page 4-16 shows how you can do this. When you start synthesizing speech, you may need a way to stop speech from being generated. You can use theStopSpeech
function to stop speech immediately, or you can use theStopSpeechAt
function to choose exactly where you want speech stopped. You can stop speech temporarily and then resume it again using thePauseSpeechAt
andContinueSpeech
functions. "Pausing Speech" beginning on page 4-18 shows how to pause or stop speech production and begin it again.You might need to synchronize speech generation with other activities. For example, your application might include an on screen animation that must be synchronized with speech generation, or your application might need to determine when the Speech Manager has finished processing text on a speech channel so that it can unlock a handle or release some memory. "Implementing Callback Procedures" beginning on page 4-19 shows how you can accomplish these goals.
If your application uses embedded speech commands to obtain exacting control over speech generation, you should read "Writing Embedded Speech Commands" beginning on page 4-23. This section describes the complete syntax of embedded commands, and provides a guide to all embedded commands supported by the Speech Manager.
The Speech Manager allows you to enter phonemic text directly. If your application speaks only text that the user writes, this feature is unlikely to be useful to you, because you cannot anticipate what the user might enter. However, if there are a few or many sentences that your application frequently converts into speech, it might be useful to represent parts of these sentences phonemically rather than textually. "Phonemic Representation of Speech" beginning on page 4-32 describes how to convert text to phonemes.
Some applications might allow the user to use pronunciation dictionaries to override the default pronunciations of certain words. "Including Pronunciation Dictionaries" beginning on page 4-36 explains how you can create a new pronunciation dictionary resource or install an existing pronunciation dictionary resource into a speech channel. The section also explains how you can provide the user with the default phonemic pronunciation of text by using the
TextToPhonemes
function.
Subtopics
- Checking for Speech Manager Capabilities
- Creating, Using, and Disposing of a Speech Channel
- Working With Different Voices
- Adjusting Speech Attributes
- Pausing Speech
- Implementing Callback Procedures
- Writing Embedded Speech Commands
- Phonemic Representation of Speech
- Including Pronunciation Dictionaries