| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.3 and later. |
| Companion guide | |
| Declared in | NSSpeechSynthesizer.h |
| Related sample code |
The NSSpeechSynthesizer class is the Cocoa interface to Speech Synthesis on Mac OS X. Instances of this class are called speech synthesizers.
Speech Synthesis, also called text-to-speech (TTS), parses text and converts it into audible speech. It offers a concurrent feedback mode that can be used in concert with or in place of traditional visual and aural notifications. For example, your application can use an NSSpeechSynthesizer object to “pronounce” the text of important alert dialogs. Synthesized speech has several advantages. It can provide urgent information to users without forcing them to shift attention from their current task. And because speech doesn’t rely on visual elements for meaning, it is a crucial technology for users with vision or attention disabilities.
In addition, synthesized speech can help save system resources. Because sound samples can take up large amounts of room on disk, using text in place of sampled sound is extremely efficient, and so a multimedia application might use an NSSpeechSynthesizer object to provide a narration of a QuickTime movie instead of including sampled-sound data on a movie track.
When you create an NSSpeechSynthesizer instance using the default initializer (init), the class uses the default voice selected in System Preferences > Speech. Alternatively, you can select a specific voice for an NSSpeechSynthesizer instance by initializing it with initWithVoice:. To begin synthesis, send either startSpeakingString: or startSpeakingString:toURL: to the instance. The former generates speech through the system’s default sound output device; the latter saves the generated speech to a file. If you wish to be notified when the current speech concludes, set a delegate object using setDelegate: and implement the delegate method speechSynthesizer:didFinishSpeaking:.
Speech Synthesis is just one of the Mac OS X speech technologies. The Speech Recognizer technology allows applications to “listen to” text spoken in U.S. English; the NSSpeechRecognizer class is the Cocoa interface to this technology. Both technologies provide benefits for all users, and are particularly useful to those users who have difficulties seeing the screen or using the mouse and keyboard.
The speech feedback window (Figure 1) displays the text recognized from the user’s speech and the text from which an NSSpeechSynthesizer object synthesizes speech. Using the feedback window makes spoken exchange more natural and helps the user understand the synthesized speech.
For example, your application may use an NSSpeechRecognizer object to listen for the command “Play some music.” When it recognizes this command, your application might then respond by speaking “Which artist?” using a speech synthesizer.
When UsesFeedbackWindow is YES, the speech synthesizer uses the feedback window if its visible, which the user specifies in System Preferences > Speech.
– usesFeedbackWindow
– setUsesFeedbackWindow:
– voice
– setVoice:
– rate
– setRate:
– volume
– setVolume:
– addSpeechDictionary:
– objectForProperty:error:
– setObject:forProperty:error:
– delegate
– setDelegate:
– isSpeaking
– startSpeakingString:
– startSpeakingString:toURL:
– pauseSpeakingAtBoundary:
– continueSpeaking
– stopSpeaking
– stopSpeakingAtBoundary:
Provides the attribute dictionary of a voice.
+ (NSDictionary *)attributesForVoice:(NSString *)voiceIdentifier
Identifier of the voice whose attributes you want to obtain.
Attribute dictionary of the voice identified by voiceIdentifier. The attributes keys and value types are listed in “Voice Attributes”
NSSpeechSynthesizer.hProvides the identifiers of the voices available on the system.
+ (NSArray *)availableVoices
Array of strings representing the identifiers of each voice available on the system.
NSSpeechSynthesizer.hProvides the identifier of the default voice.
+ (NSString *)defaultVoice
Identifier of the default voice.
NSSpeechSynthesizer.hIndicates whether any application is currently speaking through the sound output device.
+ (BOOL)isAnyApplicationSpeaking
YES when another application is producing speech through the sound output device, NO otherwise.
You usually invoke this method to prevent your application from speaking over speech being generated by another application or system component.
NSSpeechSynthesizer.hRegisters the given speech dictionary with the receiver.
- (void)addSpeechDictionary:(NSDictionary *)speechDictionary
Speech dictionary to add to the receiver’s dictionaries. The key-value pairs are listed in “Speech Dictionary Properties.”
See the discussion of UseSpeechDictionary in Speech Synthesis Manager Reference for more information.
NSSpeechSynthesizer.hResumes synthesis.
- (void)continueSpeaking
At any time after pauseSpeakingAtBoundary: is called, continueSpeaking can be called to continue speaking from the beginning of the word at which speech paused.
Sending continueSpeaking to a receiver that is not currently in a paused state has no effect on the synthesizer or on future calls to the pauseSpeakingAtBoundary: function. If you call continueSpeaking on a synthesizer before a pause is effective, continueSpeaking cancels the pause.
If the pauseSpeakingAtBoundary: method stopped speech in the middle of a word, the synthesizer will start speaking that word from the beginning when you call continueSpeaking.
NSSpeechSynthesizer.hReturns the receiver’s delegate.
- (id < NSSpeechSynthesizerDelegate >)delegate
The receiver’s delegate.
NSSpeechSynthesizer.hInitializes the receiver with a voice.
- (id)initWithVoice:(NSString *)voiceIdentifier
Identifier of the voice to set as the current voice. When nil, the default voice is used. Passing in a specific voice means the initial speaking rate is determined by the synthesizer’s default speaking rate; passing nil means the speaking rate is automatically set to the rate the user specifies in Speech preferences.
Initialized speech synthesizer or nil when the voice identified by voiceIdentifier is not available or when there’s an allocation error.
NSSpeechSynthesizer.hIndicates whether the receiver is currently generating synthesized speech.
- (BOOL)isSpeaking
YES when the receiver is generating synthesized speech, NO otherwise.
NSSpeechSynthesizer.hProvides the value of a receiver’s property.
- (id)objectForProperty:(NSString *)speechProperty error:(NSError **)out_error
Property to get.
On output, error that occurred while obtaining the value of speechProperty.
The value of speechProperty.
NSSpeechSynthesizer.hPauses synthesis in progress at a given boundary.
- (void)pauseSpeakingAtBoundary:(NSSpeechBoundary)boundary
Boundary at which to pause speech. The supported bound types are listed in “NSSpeechBoundary.”
Pass the constant NSSpeechImmediateBoundary to pause immediately, even in the middle of a word. Pass NSSpeechWordBoundary or NSSpeechSentenceBoundary to pause speech at the end of the current word or sentence, respectively.
You can determine whether your application has paused a synthesizer's speech output by obtaining the NSSpeechStatusProperty property through the objectForProperty:error: method. While a synthesizer is paused, the speech status information indicates that NSSpeechStatusOutputBusy and NSSpeechStatusOutputPaused are both YES.
If the end of the string being spoken is reached before the specified pause point, speech output pauses at the end of the string.
NSSpeechSynthesizer.hProvides the phoneme symbols generated by the given text.
- (NSString *)phonemesFromText:(NSString *)text
Text from which to generate phonemes.
Phonemes generated from text.
Converting textual data into phonetic data is particularly useful during application development, when you might wish to adjust phrases that your application generates to produce smoother speech. By first converting the target phrase into phonemes, you can see what the synthesizer will try to speak. Then you need correct only the parts that would not have been spoken the way you want
The string returned by phonemesFromText: corresponds precisely to the phonemes that would be spoken had the input text been sent to startSpeakingString: instead. All current property settings for the synthesizer are applied to the converted speech.
No delegate methods are called while phonemesFromText: method is generating its output.
NSSpeechSynthesizer.hProvides the receiver’s speaking rate.
- (float)rate
Speaking rate (words per minute).
The range of supported rates is not predefined by the Speech Synthesis framework; but the synthesizer may only respond to a limited range of speech rates. Average human speech occurs at a rate of 180 to 220 words per minute.
NSSpeechSynthesizer.hSets the receiver’s delegate.
- (void)setDelegate:(id < NSSpeechSynthesizerDelegate >)delegate
Object to be the receiver’s delegate.
NSSpeechSynthesizer.hSpecifies the value of a receiver’s property.
- (BOOL)setObject:(id)object forProperty:(NSString *)property error:(NSError **)outError
Property to set. The supported properties are listed in “NSSpeechStatusProperty Dictionary Keys.”
On output, error that occurred while setting speechProperty.
YES when the speechProperty was set. NO when there was an error, specified in out_error.
NSSpeechSynthesizer.hSpecifies the receivers speaking rate.
- (void)setRate:(float)rate
Words to speak per minute.
NSSpeechSynthesizer.hSpecifies whether the receiver uses the speech feedback window.
- (void)setUsesFeedbackWindow:(BOOL)useFeedbackWindow
YES to make the receiver use the speech feedback window if it’s visible when the user begins speaking. NO not to use the feedback window.
See the class description for details on the UsesFeedbackWindow attribute.
Important: The delegate only receives the speechSynthesizer:didFinishSpeaking: message when speaking occurs through the feedback window.
NSSpeechSynthesizer.hSets the receiver’s current voice.
- (BOOL)setVoice:(NSString *)voiceIdentifier
Identifier of the voice to set at the receiver’s current voice. When nil, the receiver sets the default voice as its current voice.
YES when the receiver is not currently synthesizing speech and the current voice is set successfully, NO otherwise.
NSSpeechSynthesizer.hSpecifies the receiver’s speaking volume.
- (void)setVolume:(float)volume
Sound level to use for speech.
Volumes are expressed in floating-point units ranging from 0.0 through 1.0. A value of 0.0 corresponds to silence, and a value of 1.0 corresponds to the maximum possible volume. Volume units lie on a scale that is linear with amplitude or voltage. A doubling of perceived loudness corresponds to a doubling of the volume.
Setting a value outside this range is undefined.
NSSpeechSynthesizer.hBegins speaking synthesized text through the system’s default sound output device.
- (BOOL)startSpeakingString:(NSString *)text
Text to speak. When nil or empty, no synthesis occurs.
YES when speaking starts successfully, NO otherwise.
If the receiver is currently speaking synthesized speech when startSpeakingString: is called, that process is stopped before text is spoken.
When synthesis of text finishes normally or is stopped, the message speechSynthesizer:didFinishSpeaking: is sent to the delegate.
NSSpeechSynthesizer.hBegins synthesizing text into a sound (AIFF) file.
- (BOOL)startSpeakingString:(NSString *)text toURL:(NSURL *)url
Text to speak. When nil or empty, no synthesis is started.
Filesystem location of the output sound file.
YES when synthesis starts successfully, NO otherwise.
When synthesis of text finishes normally or is stopped, the message speechSynthesizer:didFinishSpeaking: is sent to the delegate.
One example of how you might use this method is in an email program that automatically converts new messages into sound files that can be stored on an iPod for later listening.
speechSynthesizer:willSpeakWord:ofString: and speechSynthesizer:willSpeakPhoneme: messages when text is being synthesized to a file.NSSpeechSynthesizer.hStops synthesis in progress.
- (void)stopSpeaking
If the receiver is currently generating speech, synthesis is halted, and the message speechSynthesizer:didFinishSpeaking: is sent to the delegate.
NSSpeechSynthesizer.hStops synthesis in progress at a given boundary.
- (void)stopSpeakingAtBoundary:(NSSpeechBoundary)boundary
Boundary at which to stop speech. The supported bound types are listed in “NSSpeechBoundary.”
Pass the constant NSSpeechImmediateBoundary to stop immediately, even in the middle of a word. Pass NSSpeechWordBoundary or NSSpeechSentenceBoundary to stop speech at the end of the current word or sentence, respectively.
If the end of the string being spoken is reached before the specified stopping point, the synthesizer stops at the end of the string without generating an error.
NSSpeechSynthesizer.hIndicates whether the receiver uses the speech feedback window.
- (BOOL)usesFeedbackWindow
YES when the receiver uses the speech feedback window, NO otherwise.
NSSpeechSynthesizer.hReturns the identifier of the receiver’s current voice.
- (NSString *)voice
Identifier of the receiver’s current voice.
NSSpeechSynthesizer.hProvides the receiver’s speaking volume.
- (float)volume
Speaking volume: From 0.0 (minimum) to 1.0 (maximum).
NSSpeechSynthesizer.hThe following constants are keys for the dictionary returned by attributesForVoice:.
NSString *const NSVoiceIdentifier; NSString *const NSVoiceName; NSString *const NSVoiceAge; NSString *const NSVoiceGender; NSString *const NSVoiceDemoText; NSString *const NSVoiceLanguage; NSString *const NSVoiceLocaleIdentifier; NSString *const NSVoiceSupportedCharacters; NSString *const NSVoiceIndividuallySpokenCharacters;
NSVoiceIdentifierA unique string identifying the voice. The identifiers of the system voices are listed in Listing 1.
Available in Mac OS X v10.3 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceNameThe name of the voice suitable for display. An NSString.
Available in Mac OS X v10.3 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceAgeThe perceived age (in years) of the voice. An NSString
Available in Mac OS X v10.3 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceGenderThe perceived gender of the voice. The supported values are listed in “Voice Genders.” An NSString
Available in Mac OS X v10.3 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceDemoTextA demonstration string to speak. An NSString
Available in Mac OS X v10.3 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceLanguageThe language of the voice (currently US English only). An NSString
Deprecated: Use NSVoiceLocaleIdentifier instead.
Available in Mac OS X v10.3 and later.
Deprecated in Mac OS X v10.5.
Declared in NSSpeechSynthesizer.h.
NSVoiceLocaleIdentifierThe language of the voice. An NSString
The canonical locale identifier string describing the voice's locale. A locale is generally composed of three pieces of ordered information: a language code, a region code, and a variant code. Refer to documentation about the NSLocale class or Locales Programming Guide for more information.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceSupportedCharactersA list of unicode character id ranges that define the unicode characters supported by this voice. a dictionary containing two keys: "UnicodeCharBegin", an integer value containing the beginning unicode id of this range; and "UnicodeCharBegin", an integer value containing the ending unicode id of this range. The synthesizer will convert or ignore any characters not contained in the range of supported characters.
Some voices may not provide this attribute.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceIndividuallySpokenCharactersA list of unicode character id ranges that define the unicode characters that can be spoken in character-by-character mode by this voice. ach list entry is a dictionary containing two keys: "UnicodeCharBegin", an integer value containing the beginning unicode id of this range; and "UnicodeCharBegin", an integer value containing the ending unicode id of this range.
These ranges can be used by your application to determine if the voice can speak the name of an individual character when spoken in character-by-character mode.
Ssome voices may not provide this attribute.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
Listing 1 lists the identifiers of the system voices (defined in /System/Library/Speech/Voices):
Listing 1 Identifiers of the Mac OS X system voices
com.apple.speech.synthesis.voice.Agnes |
com.apple.speech.synthesis.voice.Albert |
com.apple.speech.synthesis.voice.Alex |
com.apple.speech.synthesis.voice.BadNews |
com.apple.speech.synthesis.voice.Bahh |
com.apple.speech.synthesis.voice.Bells |
com.apple.speech.synthesis.voice.Boing |
com.apple.speech.synthesis.voice.Bruce |
com.apple.speech.synthesis.voice.Bubbles |
com.apple.speech.synthesis.voice.Cellos |
com.apple.speech.synthesis.voice.Deranged |
com.apple.speech.synthesis.voice.Fred |
com.apple.speech.synthesis.voice.GoodNews |
com.apple.speech.synthesis.voice.Hysterical |
com.apple.speech.synthesis.voice.Junior |
com.apple.speech.synthesis.voice.Kathy |
com.apple.speech.synthesis.voice.Organ |
com.apple.speech.synthesis.voice.Princess |
com.apple.speech.synthesis.voice.Ralph |
com.apple.speech.synthesis.voice.Trinoids |
com.apple.speech.synthesis.voice.Vicki |
com.apple.speech.synthesis.voice.Victoria |
com.apple.speech.synthesis.voice.Whisper |
com.apple.speech.synthesis.voice.Zarvox |
The following constants define voice gender attributes, which are the allowable values of the NSVoiceGender key returned by attributesForVoice:.
NSString *const NSVoiceGenderNeuter; NSString *const NSVoiceGenderMale; NSString *const NSVoiceGenderFemale;
NSVoiceGenderNeuterA neutral voice (or a novelty voice with a humorous or whimsical quality).
Available in Mac OS X v10.3 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceGenderMaleA male voice
Available in Mac OS X v10.3 and later.
Declared in NSSpeechSynthesizer.h.
NSVoiceGenderFemaleA female voice
Available in Mac OS X v10.3 and later.
Declared in NSSpeechSynthesizer.h.
These constants are used with setObject:forProperty:error: and objectForProperty:error: to get or set the characteristics of a synthesizer.
NSString *const NSSpeechStatusProperty; NSString *const NSSpeechErrorsProperty; NSString *const NSSpeechInputModeProperty; NSString *const NSSpeechCharacterModeProperty; NSString *const NSSpeechNumberModeProperty; NSString *const NSSpeechRateProperty; NSString *const NSSpeechPitchBaseProperty; NSString *const NSSpeechPitchModProperty; NSString *const NSSpeechVolumeProperty; NSString *const NSSpeechSynthesizerInfoProperty; NSString *const NSSpeechRecentSyncProperty; NSString *const NSSpeechPhonemeSymbolsProperty; NSString *const NSSpeechCurrentVoiceProperty; NSString *const NSSpeechCommandDelimiterProperty; NSString *const NSSpeechResetProperty; NSString *const NSSpeechOutputToFileURLProperty;
NSSpeechStatusPropertyGet speech-status information for the synthesizer. An NSDictionary that contains speech-status information for the synthesizer. See “NSSpeechStatusProperty Dictionary Keys” for a description of the keys present in the dictionary.
This property is used with setObject:forProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechErrorsPropertyGet speech-error information for the synthesizer. An NSDictionary object that contains speech-error information. See “NSSpeechErrorProperty Dictionary Keys” for a description of the keys present in the dictionary.
This property lets you get information about various run-time errors that occur during speaking, such as the detection of badly formed embedded commands. Errors returned directly by the Speech Synthesis Manager are not reported here.
If your application implements the speechSynthesizer:didEncounterErrorAtIndex:ofString:message: delegate message, the delegate message can use this property to get error information.
This property is used with setObject:forProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechInputModePropertyGet or set the synthesizer’s current text-processing mode. An NSString object that specifies whether the channel is currently in text input mode or phoneme input mode.The supported values are listed in “Speaking Modes for NSSpeechInputModeProperty.”
When in phoneme-processing mode, a text string is interpreted to be a series of characters representing various phonemes and prosodic controls. Some synthesizers might support additional input-processing modes and define constants for these modes.
This property is used with setObject:forProperty:error: and objectForProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechCharacterModePropertyGet or set the synthesizer’s current text-processing mode. An NSString object that specifies whether the channel is currently in text input mode or phoneme input mode.The supported values are listed in “Speaking Modes for NSSpeechInputModeProperty.”
When the character-processing mode is NSSpeechModeNormal, input characters are spoken as you would expect to hear them. When the mode is NSSpeechModeLiteral, each character is spoken literally, so that the word “cat” is spoken “C–A–T”.
This property is used with setObject:forProperty:error: and objectForProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechNumberModePropertyGet or set the synthesizer’s current number-processing mode. An NSString object that specifies whether the synthesizer is currently in normal or literal number-processing mode. The constants NSSpeechModeNormal and NSSpeechModeLiteral are the possible values of this string.
When the number-processing mode is NSSpeechModeNormal, the synthesizer assembles digits into numbers (so that “12” is spoken as “twelve”). When the mode is NSSpeechModeLiteral, each digit is spoken literally (so that “12” is spoken as “one, two”).
This property is used with setObject:forProperty:error: and objectForProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechRatePropertyGet or set the synthesizer’s baseline speech pitch. An NSNumber object that specifies the synthesizer’s baseline speech pitch.
Typical voice frequencies range from around 90 hertz for a low-pitched male voice to perhaps 300 hertz for a high-pitched child’s voice. These frequencies correspond to approximate pitch values in the ranges of 30.000 to 40.000 and 55.000 to 65.000, respectively.
This property is used with setObject:forProperty:error: and objectForProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechPitchBasePropertyGet or set a synthesizer’s baseline speech pitch. An NSNumberobject that specifies the baseline speech pitch.
Typical voice frequencies range from around 90 hertz for a low-pitched male voice to perhaps 300 hertz for a high-pitched child’s voice. These frequencies correspond to approximate pitch values in the ranges of 30.000 to 40.000 and 55.000 to 65.000, respectively.
This property is used with setObject:forProperty:error: and objectForProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechPitchModPropertyGet or set a synthesizer’s pitch modulation. An NSNumber object that specifies the synthesizer’s pitch modulation.
Pitch modulation is also expressed as a floating-point value in the range of 0.000 to 127.000. These values correspond to MIDI note values, where 60.000 is equal to middle C on a piano scale. The most useful speech pitches fall in the range of 40.000 to 55.000. A pitch modulation value of 0.000 corresponds to a monotone in which all speech is generated at the frequency corresponding to the speech pitch. Given a speech pitch value of 46.000, a pitch modulation of 2.000 would mean that the widest possible range of pitches corresponding to the actual frequency of generated text would be 44.000 to 48.000.
This property is used with setObject:forProperty:error: and objectForProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechVolumePropertyGet or set the speech volume for a synthesizer. An NSNumber that specifies the synthesizer’s speech volume.
Volumes are expressed in floating-point values ranging from 0.0 through 1.0. A value of 0.0 corresponds to silence, and a value of 1.0 corresponds to the maximum possible volume. Volume units lie on a scale that is linear with amplitude or voltage. A doubling of perceived loudness corresponds to a doubling of the volume.
This property is used with setObject:forProperty:error: and objectForProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechSynthesizerInfoPropertyGet information about the speech synthesizer being used on the specified synthesizer. An NSDictionary object that contains information about the speech synthesizer being used on the specified synthesizer. See “Speech Synthesizer Property Keys” for a description of the keys present in the dictionary.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechRecentSyncPropertyGet the message code for the most recently encountered synchronization command. An NSNumber object that specifies the most recently encountered synchronization command.
This property works with setObject:forProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechPhonemeSymbolsPropertyGet a list of phoneme symbols and example words defined for the synthesizer. An NSDictionary object that contains the phoneme symbols and example words defined for the current synthesizer
Your application might use this information to show the user what symbols to use when entering phonemic text directly. See “NSSpeechPhonemeSymbolsProperty Dictionary Keys” for a description of the keys present in the dictionary.
This property works with setObject:forProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechCurrentVoicePropertySet the current voice on the synthesizer to the specified voice. An NSDictionary object that contains the phoneme symbols and example words defined for the current synthesizer.
Your application might use this information to show the user what symbols to use when entering phonemic text directly. See “NSSpeechPhonemeSymbolsProperty Dictionary Keys” for the keys you can use to specify values in this dictionary.
This property works with setObject:forProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechCommandDelimiterPropertySet the embedded speech command delimiter characters to be used for the synthesizer. An NSDictionary object that contains the delimiter information. See “Command Delimiter Keys” for the keys you can use to specify values in this dictionary.
By default, the opening delimiter is “[[” and the closing delimiter is “]]”. Your application might need to change these delimiters temporarily if those character sequences occur naturally in a text buffer that is to be spoken. Your application can also disable embedded command processing by passing empty delimiters (as empty strings). See “Speech Command Delimiter” for the keys you can use to specify values in this dictionary.
This property works with setObject:forProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechResetPropertySet a synthesizer back to its default state. There is no value associated with this property; to reset the channel to its default state, set the key to NULL.
You can use this function to, for example, set speech pitch and speech rate to default values.
This property works with setObject:forProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechOutputToFileURLPropertySet the speech output destination to a file or to the computer’s speakers. An NSURL object. To write the speech output to a file, use the file’s NSURL; to generate the sound through the computer’s speakers, use NULL.
This property works with setObject:forProperty:error:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These constants identify input modes are used with NSSpeechInputModeProperty.
NSString *const NSSpeechModeText; NSString *const NSSpeechModePhoneme;
NSSpeechModeTextIndicates that the synthesizer is in text-processing mode.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechModePhonemeIndicates that the synthesizer is in phoneme-processing mode. When in phoneme-processing mode, a text buffer is interpreted to be a series of characters representing various phonemes and prosodic controls.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These constants define the available text-processing and number-processing modes for a synthesizer. These keys are used with NSSpeechInputModeProperty and NSSpeechNumberModeProperty)
NSString *const NSSpeechModeNormal; NSString *const NSSpeechModeLiteral;
NSSpeechModeNormalIndicates that the synthesizer assembles digits into numbers (so that 12 is spoken as "twelve") and text into words.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechModeLiteralIndicates that each digit or character is spoken literally (so that 12 is spoken as "one, two", or the word "cat" is spoken as "C A T").
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These constants identify speech status keys used with NSSpeechStatusProperty.
NSString *const NSSpeechStatusOutputBusy; NSString *const NSSpeechStatusOutputPaused; NSString *const NSSpeechStatusNumberOfCharactersLeft; NSString *const NSSpeechStatusPhonemeCode;
NSSpeechStatusOutputBusyIndicates whether the synthesizer is currently producing speech.
A synthesizer is considered to be producing speech even at some times when no audio data is being produced through the computer’s speaker. This occurs, for example, when the synthesizer is processing input, but has not yet initiated speech or when speech output is paused.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechStatusOutputPausedIndicates whether speech output in the synthesizer has been paused by sending the message pauseSpeakingAtBoundary:.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechStatusNumberOfCharactersLeftThe number of characters left in the input string of text.
When the value of this key is zero, you can destroy the input string.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechStatusPhonemeCodeIndicates that the synthesizer is in phoneme-processing mode. When in phoneme-processing mode, a text buffer is interpreted to be a series of characters representing various phonemes and prosodic controls.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These key constants identify errors that may occur during speech synthesis. They are used with NSSpeechErrorsProperty.
NSString *const NSSpeechErrorCount; NSString *const NSSpeechErrorOldestCode; NSString *const NSSpeechErrorOldestCharacterOffset; NSString *const NSSpeechErrorNewestCode; NSString *const NSSpeechErrorNewestCharacterOffset;
NSSpeechErrorCountThe number of errors that have occurred in processing the current text string, since the last call to objectForProperty:error: with the NSSpeechErrorsProperty property. An NSNumber
Using the NSSpeechErrorOldestCode keys and the NSSpeechErrorNewestCode keys, you can get information about the oldest and most recent errors that occurred since the last call to objectForProperty:error:, but you cannot get information about any intervening errors.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechErrorOldestCodeThe error code of the first error that occurred since the last call to objectForProperty:error: with the NSSpeechErrorsProperty property. An NSNumber
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechErrorOldestCharacterOffsetThe position in the text string of the first error that occurred since the last call to objectForProperty:error: with the NSSpeechErrorsProperty property. An NSNumber
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechErrorNewestCodeThe error code of the most recent error that occurred since the last call to objectForProperty:error: with the NSSpeechErrorsProperty property. An NSNumber
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechErrorNewestCharacterOffsetThe position in the text string of the most recent error that occurred since the last call to objectForProperty:error: with the NSSpeechErrorsProperty property. An NSNumber.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These constants are keys used in the NSSpeechSynthesizerInfoProperty dictionary.
NSString *const NSSpeechSynthesizerInfoIdentifier; NSString *const NSSpeechSynthesizerInfoVersion;
NSSpeechSynthesizerInfoIdentifierThe identifier of the speech synthesizer.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechSynthesizerInfoVersionThe version of the speech synthesizer.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These constants are keys used in the NSSpeechPhonemeSymbolsProperty dictionary.
NSString *const NSSpeechPhonemeInfoOpcode NSString *const NSSpeechPhonemeInfoSymbol; NSString *const NSSpeechPhonemeInfoExample; NSString *const NSSpeechPhonemeInfoHiliteStart; NSString *const NSSpeechPhonemeInfoHiliteEnd;
NSSpeechPhonemeInfoOpcodeNSNumber
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechPhonemeInfoSymbolThe symbol used to represent the phoneme.
The symbol does not necessarily have a phonetic connection to the phoneme, but might simply be an abstract textual representation of it.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechPhonemeInfoExampleAn example word that illustrates the use of the phoneme.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechPhonemeInfoHiliteStartThe character offset into the example word that identifies the location of the beginning of the phoneme.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechPhonemeInfoHiliteEndThe character offset into the example word that identifies the location of the end of the phoneme.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These constants speech-command delimiters keys used in NSSpeechCommandDelimiterProperty .
NSString *const NSSpeechCommandPrefix; NSString *const NSSpeechCommandSuffix;
NSSpeechCommandPrefixThe command delimiter string that prefixes a command, by default, this is [[.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechCommandSuffixThe command delimiter string that suffixes a command,by default, this is ]].
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These constants identify key-value pairs used to add vocabulary to the dictionary using addSpeechDictionary:.
NSString *const NSSpeechDictionaryLocaleIdentifier; NSString *const NSSpeechDictionaryModificationDate; NSString *const NSSpeechDictionaryPronunciations; NSString *const NSSpeechDictionaryAbbreviations; NSString *const NSSpeechDictionaryEntrySpelling; NSString *const NSSpeechDictionaryEntryPhonemes;
NSSpeechDictionaryLocaleIdentifierThe canonical locale identifier string describing the dictionary's locale. A locale is generally composed of three pieces of ordered information: a language code, a region code, and a variant code. Refer to documentation about NSLocale or Locales Programming Guide for more information
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechDictionaryModificationDateA string representation of the dictionary's last modification date in the international format (YYYY-MM-DD HH:MM:SS ±HHMM). If the same word appears across multiple dictionaries, the one from the dictionary with the most recent date will be used.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechDictionaryPronunciationsAn array of dictionary objects containing the keys NSSpeechDictionaryEntrySpelling and NSSpeechDictionaryEntryPhonemes.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechDictionaryAbbreviationsAn array of dictionary objects containing the keys NSSpeechDictionaryEntrySpelling and NSSpeechDictionaryEntryPhonemes.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechDictionaryEntrySpellingThe spelling of an entry. An NSString.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechDictionaryEntryPhonemesThe phonemic representation of an entry. An NSString.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
These constants are used to indicate where speech should be stopped and paused. See pauseSpeakingAtBoundary: and stopSpeakingAtBoundary:.
enum {
NSSpeechImmediateBoundary = 0,
NSSpeechWordBoundary,
NSSpeechSentenceBoundary
};
typedef NSUInteger NSSpeechBoundary;
NSSpeechImmediateBoundarySpeech should be paused or stopped immediately.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechWordBoundarySpeech should be paused or stopped at the end of the word.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
NSSpeechSentenceBoundarySpeech should be paused or stopped at the end of the sentence.
Available in Mac OS X v10.5 and later.
Declared in NSSpeechSynthesizer.h.
Last updated: 2009-08-20