Mac Developer Library

Developer

AppKit Framework Reference NSSpeechSynthesizer Class Reference

Options
Deployment Target:

On This Page
Language:

NSSpeechSynthesizer

The NSSpeechSynthesizer class is the Cocoa interface to Speech Synthesis on OS X. Instances of this class are called speech synthesizers. More...

Inheritance


Conforms To


Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.3 and later.
  • Initializes the receiver with a voice.

    Declaration

    Swift

    init!(voice voiceIdentifier: String?)

    Objective-C

    - (instancetype)initWithVoice:(NSString *)voiceIdentifier

    Parameters

    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.

    Return Value

    Initialized speech synthesizer or nil when the voice identified by voiceIdentifier is not available or when there’s an allocation error.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Indicates whether the receiver uses the speech feedback window.

    Declaration

    Swift

    var usesFeedbackWindow: Bool

    Objective-C

    @property BOOL usesFeedbackWindow

    Discussion

    YEStrue when the receiver uses the speech feedback window, NOfalse otherwise.

    See the class description for details on the UsesFeedbackWindow attribute.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Returns the identifier of the receiver’s current voice.

    Declaration

    Swift

    func voice() -> String?

    Objective-C

    - (NSString *)voice

    Return Value

    Identifier of the receiver’s current voice.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

    See Also

    – setVoice:

  • Sets the receiver’s current voice.

    Declaration

    Swift

    func setVoice(_ voiceIdentifier: String?) -> Bool

    Objective-C

    - (BOOL)setVoice:(NSString *)voiceIdentifier

    Parameters

    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.

    Return Value

    YEStrue when the receiver is not currently synthesizing speech and the current voice is set successfully, NOfalse otherwise.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • rate rate Property

    The synthesizer’s speaking rate (words per minute).

    Declaration

    Swift

    var rate: Float

    Objective-C

    @property float rate

    Discussion

    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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • volume volume Property

    The synthesizer’s speaking volume.

    Declaration

    Swift

    var volume: Float

    Objective-C

    @property float volume

    Discussion

    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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Registers the given speech dictionary with the receiver.

    Declaration

    Swift

    func addSpeechDictionary(_ speechDictionary: [NSObject : AnyObject])

    Objective-C

    - (void)addSpeechDictionary:(NSDictionary *)speechDictionary

    Parameters

    speechDictionary

    Speech dictionary to add to the receiver’s dictionaries. The key-value pairs are listed in Speech Dictionary Properties.

    Discussion

    See the discussion of UseSpeechDictionary in Speech Synthesis Manager Reference for more information.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Provides the value of a receiver’s property.

    Declaration

    Swift

    func objectForProperty(_ speechProperty: String, error out_error: NSErrorPointer) -> AnyObject?

    Objective-C

    - (id)objectForProperty:(NSString *)speechProperty error:(NSError **)out_error

    Parameters

    speechProperty

    Property to get.

    out_error

    On output, error that occurred while obtaining the value of speechProperty.

    Return Value

    The value of speechProperty.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Specifies the value of a receiver’s property.

    Declaration

    Swift

    func setObject(_ object: AnyObject?, forProperty property: String, error outError: NSErrorPointer) -> Bool

    Objective-C

    - (BOOL)setObject:(id)object forProperty:(NSString *)property error:(NSError **)outError

    Parameters

    speechProperty

    Property to set. The supported properties are listed in NSSpeechStatusProperty Dictionary Keys.

    out_error

    On output, error that occurred while setting speechProperty.

    Return Value

    YEStrue when the speechProperty was set. NOfalse when there was an error, specified in out_error.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • delegate delegate Property

    The synthesizer’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: NSSpeechSynthesizerDelegate?

    Objective-C

    @property(assign) id< NSSpeechSynthesizerDelegate > delegate

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Provides the identifiers of the voices available on the system.

    Declaration

    Swift

    class func availableVoices() -> [AnyObject]?

    Objective-C

    + (NSArray *)availableVoices

    Return Value

    Array of strings representing the identifiers of each voice available on the system.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Provides the attribute dictionary of a voice.

    Declaration

    Swift

    class func attributesForVoice(_ voiceIdentifier: String) -> [NSObject : AnyObject]?

    Objective-C

    + (NSDictionary *)attributesForVoice:(NSString *)voiceIdentifier

    Parameters

    voiceIdentifier

    Identifier of the voice whose attributes you want to obtain.

    Return Value

    Attribute dictionary of the voice identified by voiceIdentifier. The attributes keys and value types are listed in Voice Attributes

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Provides the identifier of the default voice.

    Declaration

    Swift

    class func defaultVoice() -> String!

    Objective-C

    + (NSString *)defaultVoice

    Return Value

    Identifier of the default voice.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Indicates whether any application is currently speaking through the sound output device.

    Declaration

    Swift

    class func isAnyApplicationSpeaking() -> Bool

    Objective-C

    + (BOOL)isAnyApplicationSpeaking

    Return Value

    YEStrue when another application is producing speech through the sound output device, NOfalse otherwise.

    Discussion

    You usually invoke this method to prevent your application from speaking over speech being generated by another application or system component.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Provides the phoneme symbols generated by the given text.

    Declaration

    Swift

    func phonemesFromText(_ text: String) -> String!

    Objective-C

    - (NSString *)phonemesFromText:(NSString *)text

    Parameters

    text

    Text from which to generate phonemes.

    Return Value

    Phonemes generated from text.

    Discussion

    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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • The following constants are keys for the dictionary returned by attributesForVoice:.

    Declaration

    Swift

    let NSVoiceIdentifier: NSString! let NSVoiceName: NSString! let NSVoiceAge: NSString! let NSVoiceGender: NSString! let NSVoiceDemoText: NSString! let NSVoiceLocaleIdentifier: NSString! let NSVoiceSupportedCharacters: NSString! let NSVoiceIndividuallySpokenCharacters: NSString!

    Objective-C

    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;

    Constants

    • NSVoiceIdentifier

      NSVoiceIdentifier

      A unique string identifying the voice. The identifiers of the system voices are listed in Listing 1.

      Available in OS X v10.3 and later.

    • NSVoiceName

      NSVoiceName

      The name of the voice suitable for display. An NSString.

      Available in OS X v10.3 and later.

    • NSVoiceAge

      NSVoiceAge

      The perceived age (in years) of the voice. An NSString

      Available in OS X v10.3 and later.

    • NSVoiceGender

      NSVoiceGender

      The perceived gender of the voice. The supported values are listed in Voice Genders. An NSString

      Available in OS X v10.3 and later.

    • NSVoiceDemoText

      NSVoiceDemoText

      A demonstration string to speak. An NSString

      Available in OS X v10.3 and later.

    • NSVoiceLanguage

      NSVoiceLanguage

      The language of the voice (currently US English only). An NSString

      Deprecated: Use NSVoiceLocaleIdentifier instead.

      Available in OS X v10.0 and later.

      Deprecated in OS X v10.5.

    • NSVoiceLocaleIdentifier

      NSVoiceLocaleIdentifier

      The 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 Internationalization and Localization Guide for more information.

      Available in OS X v10.5 and later.

    • NSVoiceSupportedCharacters

      NSVoiceSupportedCharacters

      A 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 OS X v10.5 and later.

    • NSVoiceIndividuallySpokenCharacters

      NSVoiceIndividuallySpokenCharacters

      A 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.

      Some voices may not provide this attribute.

      Available in OS X v10.5 and later.

    Discussion

    Listing 1 lists the identifiers of the system voices (defined in /System/Library/Speech/Voices):

    Listing 1Identifiers of the 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

    Import Statement

  • The following constants define voice gender attributes, which are the allowable values of the NSVoiceGender key returned by attributesForVoice:.

    Declaration

    Swift

    let NSVoiceGenderNeuter: NSString! let NSVoiceGenderMale: NSString! let NSVoiceGenderFemale: NSString!

    Objective-C

    NSString *const NSVoiceGenderNeuter; NSString *const NSVoiceGenderMale; NSString *const NSVoiceGenderFemale;

    Constants

    • NSVoiceGenderNeuter

      NSVoiceGenderNeuter

      A neutral voice (or a novelty voice with a humorous or whimsical quality).

      Available in OS X v10.3 and later.

    • NSVoiceGenderMale

      NSVoiceGenderMale

      A male voice

      Available in OS X v10.3 and later.

    • NSVoiceGenderFemale

      NSVoiceGenderFemale

      A female voice

      Available in OS X v10.3 and later.

    Import Statement

  • These constants are used with setObject:forProperty:error: and objectForProperty:error: to get or set the characteristics of a synthesizer.

    Declaration

    Swift

    let NSSpeechStatusProperty: NSString! let NSSpeechErrorsProperty: NSString! let NSSpeechInputModeProperty: NSString! let NSSpeechCharacterModeProperty: NSString! let NSSpeechNumberModeProperty: NSString! let NSSpeechRateProperty: NSString! let NSSpeechPitchBaseProperty: NSString! let NSSpeechPitchModProperty: NSString! let NSSpeechVolumeProperty: NSString! let NSSpeechSynthesizerInfoProperty: NSString! let NSSpeechRecentSyncProperty: NSString! let NSSpeechPhonemeSymbolsProperty: NSString! let NSSpeechCurrentVoiceProperty: NSString! let NSSpeechCommandDelimiterProperty: NSString! let NSSpeechResetProperty: NSString! let NSSpeechOutputToFileURLProperty: NSString!

    Objective-C

    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;

    Constants

    • NSSpeechStatusProperty

      NSSpeechStatusProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechErrorsProperty

      NSSpeechErrorsProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechInputModeProperty

      NSSpeechInputModeProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechCharacterModeProperty

      NSSpeechCharacterModeProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechNumberModeProperty

      NSSpeechNumberModeProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechRateProperty

      NSSpeechRateProperty

      Get or set a synthesizer’s speech rate. An NSNumber object that specifies the synthesizer’s speaking rate.

      The range of supported rates is not predefined by the NSSpeechSynthesizer class; each speech synthesizer provides its own range of speech rates. Average human speech occurs at a rate of 180 to 220 words per minute.

      This property is used with setObject:forProperty:error: and objectForProperty:error:.

      Available in OS X v10.5 and later.

    • NSSpeechPitchBaseProperty

      NSSpeechPitchBaseProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechPitchModProperty

      NSSpeechPitchModProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechVolumeProperty

      NSSpeechVolumeProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechSynthesizerInfoProperty

      NSSpeechSynthesizerInfoProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechRecentSyncProperty

      NSSpeechRecentSyncProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechPhonemeSymbolsProperty

      NSSpeechPhonemeSymbolsProperty

      Get 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 OS X v10.5 and later.

    • NSSpeechCurrentVoiceProperty

      NSSpeechCurrentVoiceProperty

      Set 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 OS X v10.5 and later.

    • NSSpeechCommandDelimiterProperty

      NSSpeechCommandDelimiterProperty

      Set 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 OS X v10.5 and later.

    • NSSpeechResetProperty

      NSSpeechResetProperty

      Set 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 OS X v10.5 and later.

    • NSSpeechOutputToFileURLProperty

      NSSpeechOutputToFileURLProperty

      Set 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 OS X v10.5 and later.

    Import Statement

  • These constants identify input modes are used with NSSpeechInputModeProperty.

    Declaration

    Swift

    let NSSpeechModeText: NSString! let NSSpeechModePhoneme: NSString!

    Objective-C

    NSString *const NSSpeechModeText; NSString *const NSSpeechModePhoneme;

    Constants

    • NSSpeechModeText

      NSSpeechModeText

      Indicates that the synthesizer is in text-processing mode.

      Available in OS X v10.5 and later.

    • NSSpeechModePhoneme

      NSSpeechModePhoneme

      Indicates 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 OS X v10.5 and later.

    Import Statement

  • These constants define the available text-processing and number-processing modes for a synthesizer. These keys are used with NSSpeechInputModeProperty and NSSpeechNumberModeProperty)

    Declaration

    Swift

    let NSSpeechModeNormal: NSString! let NSSpeechModeLiteral: NSString!

    Objective-C

    NSString *const NSSpeechModeNormal; NSString *const NSSpeechModeLiteral;

    Constants

    • NSSpeechModeNormal

      NSSpeechModeNormal

      Indicates that the synthesizer assembles digits into numbers (so that 12 is spoken as "twelve") and text into words.

      Available in OS X v10.5 and later.

    • NSSpeechModeLiteral

      NSSpeechModeLiteral

      Indicates 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 OS X v10.5 and later.

    Import Statement

  • These constants identify speech status keys used with NSSpeechStatusProperty.

    Declaration

    Swift

    let NSSpeechStatusOutputBusy: NSString! let NSSpeechStatusOutputPaused: NSString! let NSSpeechStatusNumberOfCharactersLeft: NSString! let NSSpeechStatusPhonemeCode: NSString!

    Objective-C

    NSString *const NSSpeechStatusOutputBusy; NSString *const NSSpeechStatusOutputPaused; NSString *const NSSpeechStatusNumberOfCharactersLeft; NSString *const NSSpeechStatusPhonemeCode;

    Constants

    • NSSpeechStatusOutputBusy

      NSSpeechStatusOutputBusy

      Indicates 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 OS X v10.5 and later.

    • NSSpeechStatusOutputPaused

      NSSpeechStatusOutputPaused

      Indicates whether speech output in the synthesizer has been paused by sending the message pauseSpeakingAtBoundary:.

      Available in OS X v10.5 and later.

    • NSSpeechStatusNumberOfCharactersLeft

      NSSpeechStatusNumberOfCharactersLeft

      The 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 OS X v10.5 and later.

    • NSSpeechStatusPhonemeCode

      NSSpeechStatusPhonemeCode

      Indicates 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 OS X v10.5 and later.

    Import Statement

  • These key constants identify errors that may occur during speech synthesis. They are used with NSSpeechErrorsProperty.

    Declaration

    Swift

    let NSSpeechErrorCount: NSString! let NSSpeechErrorOldestCode: NSString! let NSSpeechErrorOldestCharacterOffset: NSString! let NSSpeechErrorNewestCode: NSString! let NSSpeechErrorNewestCharacterOffset: NSString!

    Objective-C

    NSString *const NSSpeechErrorCount; NSString *const NSSpeechErrorOldestCode; NSString *const NSSpeechErrorOldestCharacterOffset; NSString *const NSSpeechErrorNewestCode; NSString *const NSSpeechErrorNewestCharacterOffset;

    Constants

    • NSSpeechErrorCount

      NSSpeechErrorCount

      The 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 OS X v10.5 and later.

    • NSSpeechErrorOldestCode

      NSSpeechErrorOldestCode

      The error code of the first error that occurred since the last call to objectForProperty:error: with the NSSpeechErrorsProperty property. An NSNumber

      Available in OS X v10.5 and later.

    • NSSpeechErrorOldestCharacterOffset

      NSSpeechErrorOldestCharacterOffset

      The 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 OS X v10.5 and later.

    • NSSpeechErrorNewestCode

      NSSpeechErrorNewestCode

      The error code of the most recent error that occurred since the last call to objectForProperty:error: with the NSSpeechErrorsProperty property. An NSNumber

      Available in OS X v10.5 and later.

    • NSSpeechErrorNewestCharacterOffset

      NSSpeechErrorNewestCharacterOffset

      The 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 OS X v10.5 and later.

    Import Statement

  • These constants are keys used in the NSSpeechSynthesizerInfoProperty dictionary.

    Declaration

    Swift

    let NSSpeechSynthesizerInfoIdentifier: NSString! let NSSpeechSynthesizerInfoVersion: NSString!

    Objective-C

    NSString *const NSSpeechSynthesizerInfoIdentifier; NSString *const NSSpeechSynthesizerInfoVersion;

    Constants

    • NSSpeechSynthesizerInfoIdentifier

      NSSpeechSynthesizerInfoIdentifier

      The identifier of the speech synthesizer.

      Available in OS X v10.5 and later.

    • NSSpeechSynthesizerInfoVersion

      NSSpeechSynthesizerInfoVersion

      The version of the speech synthesizer.

      Available in OS X v10.5 and later.

    Import Statement

  • These constants are keys used in the NSSpeechPhonemeSymbolsProperty dictionary.

    Declaration

    Swift

    let NSSpeechPhonemeInfoOpcode: NSString! let NSSpeechPhonemeInfoSymbol: NSString! let NSSpeechPhonemeInfoExample: NSString! let NSSpeechPhonemeInfoHiliteStart: NSString! let NSSpeechPhonemeInfoHiliteEnd: NSString!

    Objective-C

    NSString *const NSSpeechPhonemeInfoOpcode NSString *const NSSpeechPhonemeInfoSymbol; NSString *const NSSpeechPhonemeInfoExample; NSString *const NSSpeechPhonemeInfoHiliteStart; NSString *const NSSpeechPhonemeInfoHiliteEnd;

    Constants

    • NSSpeechPhonemeInfoOpcode

      NSSpeechPhonemeInfoOpcode

      NSNumber

      Available in OS X v10.5 and later.

    • NSSpeechPhonemeInfoSymbol

      NSSpeechPhonemeInfoSymbol

      The 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 OS X v10.5 and later.

    • NSSpeechPhonemeInfoExample

      NSSpeechPhonemeInfoExample

      An example word that illustrates the use of the phoneme.

      Available in OS X v10.5 and later.

    • NSSpeechPhonemeInfoHiliteStart

      NSSpeechPhonemeInfoHiliteStart

      The character offset into the example word that identifies the location of the beginning of the phoneme.

      Available in OS X v10.5 and later.

    • NSSpeechPhonemeInfoHiliteEnd

      NSSpeechPhonemeInfoHiliteEnd

      The character offset into the example word that identifies the location of the end of the phoneme.

      Available in OS X v10.5 and later.

    Import Statement

  • These constants speech-command delimiters keys used in NSSpeechCommandDelimiterProperty .

    Declaration

    Swift

    let NSSpeechCommandPrefix: NSString! let NSSpeechCommandSuffix: NSString!

    Objective-C

    NSString *const NSSpeechCommandPrefix; NSString *const NSSpeechCommandSuffix;

    Constants

    • NSSpeechCommandPrefix

      NSSpeechCommandPrefix

      The command delimiter string that prefixes a command, by default, this is [[.

      Available in OS X v10.5 and later.

    • NSSpeechCommandSuffix

      NSSpeechCommandSuffix

      The command delimiter string that suffixes a command,by default, this is ]].

      Available in OS X v10.5 and later.

    Import Statement

  • These constants identify key-value pairs used to add vocabulary to the dictionary using addSpeechDictionary:.

    Declaration

    Swift

    let NSSpeechDictionaryLocaleIdentifier: NSString! let NSSpeechDictionaryModificationDate: NSString! let NSSpeechDictionaryPronunciations: NSString! let NSSpeechDictionaryAbbreviations: NSString! let NSSpeechDictionaryEntrySpelling: NSString! let NSSpeechDictionaryEntryPhonemes: NSString!

    Objective-C

    NSString *const NSSpeechDictionaryLocaleIdentifier; NSString *const NSSpeechDictionaryModificationDate; NSString *const NSSpeechDictionaryPronunciations; NSString *const NSSpeechDictionaryAbbreviations; NSString *const NSSpeechDictionaryEntrySpelling; NSString *const NSSpeechDictionaryEntryPhonemes;

    Constants

    • NSSpeechDictionaryLocaleIdentifier

      NSSpeechDictionaryLocaleIdentifier

      The 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 Internationalization and Localization Guide for more information

      Available in OS X v10.5 and later.

    • NSSpeechDictionaryModificationDate

      NSSpeechDictionaryModificationDate

      A 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 OS X v10.5 and later.

    • NSSpeechDictionaryPronunciations

      NSSpeechDictionaryPronunciations

      An array of dictionary objects containing the keys NSSpeechDictionaryEntrySpelling and NSSpeechDictionaryEntryPhonemes.

      Available in OS X v10.5 and later.

    • NSSpeechDictionaryAbbreviations

      NSSpeechDictionaryAbbreviations

      An array of dictionary objects containing the keys NSSpeechDictionaryEntrySpelling and NSSpeechDictionaryEntryPhonemes.

      Available in OS X v10.5 and later.

    • NSSpeechDictionaryEntrySpelling

      NSSpeechDictionaryEntrySpelling

      The spelling of an entry. An NSString.

      Available in OS X v10.5 and later.

    • NSSpeechDictionaryEntryPhonemes

      NSSpeechDictionaryEntryPhonemes

      The phonemic representation of an entry. An NSString.

      Available in OS X v10.5 and later.

    Import Statement

  • These constants are used to indicate where speech should be stopped and paused. See pauseSpeakingAtBoundary: and stopSpeakingAtBoundary:.

    Declaration

    Swift

    enum NSSpeechBoundary : UInt { case ImmediateBoundary case WordBoundary case SentenceBoundary }

    Objective-C

    enum { NSSpeechImmediateBoundary = 0, NSSpeechWordBoundary, NSSpeechSentenceBoundary }; typedef NSUInteger NSSpeechBoundary;

    Constants

    • ImmediateBoundary

      NSSpeechImmediateBoundary

      Speech should be paused or stopped immediately.

      Available in OS X v10.5 and later.

    • WordBoundary

      NSSpeechWordBoundary

      Speech should be paused or stopped at the end of the word.

      Available in OS X v10.5 and later.

    • SentenceBoundary

      NSSpeechSentenceBoundary

      Speech should be paused or stopped at the end of the sentence.

      Available in OS X v10.5 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.5 and later.