iOS Developer Library

Developer

AVFoundation Framework Reference AVSpeechUtterance Class Reference

Options
Deployment Target:

On This Page
Language:

AVSpeechUtterance

An AVSpeechUtterance is the basic unit of speech synthesis. An utterance encapsulates some amount of text to be spoken and a set of parameters affecting its speech: voice, pitch, rate, and delay. More...

Inheritance


Import Statement


import AVFoundation @import AVFoundation;

Availability


Available in iOS 7.0 and later.
  • Initializes an utterance object with text to be spoken.

    Declaration

    Swift

    init!(string string: String!)

    Objective-C

    - (instancetype)initWithString:(NSString *)string

    Parameters

    string

    A string containing text to be spoken.

    Return Value

    An AVSpeechUtterance object that can speak the specified text.

    Discussion

    To speak the text, the utterance must be passed to an instance of AVSpeechSynthesizer.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

    See Also

    speakUtterance:

  • Creates an utterance object with text to be spoken.

    Declaration

    Objective-C

    + (instancetype)speechUtteranceWithString:(NSString *)string

    Parameters

    string

    A string containing text to be spoken.

    Return Value

    An AVSpeechUtterance object that can speak the specified text.

    Discussion

    To speak the text, the utterance must be passed to an instance of AVSpeechSynthesizer.

    Import Statement

    Availability

    Available in iOS 7.0 and later.

  • The baseline pitch at which the utterance will be spoken.

    Declaration

    Swift

    var pitchMultiplier: Float

    Objective-C

    @property(nonatomic) float pitchMultiplier

    Discussion

    The default pitch is 1.0. Allowed values are in the range from 0.5 (for lower pitch) to 2.0 (for higher pitch).

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • The amount of time a speech synthesizer will wait after the utterance is spoken before handling the next queued utterance.

    Declaration

    Swift

    var postUtteranceDelay: NSTimeInterval

    Objective-C

    @property(nonatomic) NSTimeInterval postUtteranceDelay

    Discussion

    When two or more utterances are spoken by an instance of AVSpeechSynthesizer, the time between periods when either is audible will be at least the sum of the first utterance’s postUtteranceDelay and the second utterance’s preUtteranceDelay.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • The amount of time a speech synthesizer will wait before actually speaking the utterance upon beginning to handle it.

    Declaration

    Swift

    var preUtteranceDelay: NSTimeInterval

    Objective-C

    @property(nonatomic) NSTimeInterval preUtteranceDelay

    Discussion

    When two or more utterances are spoken by an instance of AVSpeechSynthesizer, the time between periods when either is audible will be at least the sum of the first utterance’s postUtteranceDelay and the second utterance’s preUtteranceDelay.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • rate rate Property

    The rate at which the utterance will be spoken.

    Declaration

    Swift

    var rate: Float

    Objective-C

    @property(nonatomic) float rate

    Discussion

    Speech rates are values in the range between AVSpeechUtteranceMinimumSpeechRate and AVSpeechUtteranceMaximumSpeechRate. Lower values correspond to slower speech, and vice versa. The default value is AVSpeechUtteranceDefaultSpeechRate.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • The text to be spoken in the utterance. (read-only)

    Declaration

    Swift

    var speechString: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *speechString

    Discussion

    An utterance’s text cannot be changed once it is created. To speak different text, create a new utterance.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • voice voice Property

    The voice used to speak the utterance.

    Declaration

    Swift

    var voice: AVSpeechSynthesisVoice!

    Objective-C

    @property(nonatomic, retain) AVSpeechSynthesisVoice *voice

    Discussion

    The default value is nil, which causes the utterance to be spoken in the default voice.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • volume volume Property

    The volume used when speaking the utterance.

    Declaration

    Swift

    var volume: Float

    Objective-C

    @property(nonatomic) float volume

    Discussion

    Allowed values are in the range from 0.0 (silent) to 1.0 (loudest). The default volume is 1.0.

    Import Statement

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • Allowed rates for synthesized speech.

    Declaration

    Swift

    let AVSpeechUtteranceMinimumSpeechRate: Float let AVSpeechUtteranceMaximumSpeechRate: Float let AVSpeechUtteranceDefaultSpeechRate: Float

    Objective-C

    const float AVSpeechUtteranceMinimumSpeechRate; const float AVSpeechUtteranceMaximumSpeechRate; const float AVSpeechUtteranceDefaultSpeechRate;

    Constants

    • AVSpeechUtteranceMinimumSpeechRate

      AVSpeechUtteranceMinimumSpeechRate

      The minimum allowed speech rate.

      Available in iOS 7.0 and later.

    • AVSpeechUtteranceMaximumSpeechRate

      AVSpeechUtteranceMaximumSpeechRate

      The maximum allowed speech rate.

      Available in iOS 7.0 and later.

    • AVSpeechUtteranceDefaultSpeechRate

      AVSpeechUtteranceDefaultSpeechRate

      The default rate at which an utterance is spoken unless its rate property is changed.

      Available in iOS 7.0 and later.

    Import Statement