An object that produces synthesized speech from text utterances and provides controls for monitoring or controlling ongoing speech.


class AVSpeechSynthesizer : NSObject


The AVSpeechSynthesizer class produces synthesized speech from text on an iOS device, and provides methods for controlling or monitoring the progress of ongoing speech.

To speak some amount of text, you must first create an AVSpeechUtterance instance containing the text. (Optionally, you may also use the utterance object to control parameters affecting its speech, such as voice, pitch, and rate.) Then, pass it to the speak(_:) method on a speech synthesizer instance to speak that utterance.

The speech synthesizer maintains a queue of utterances to be spoken. If the synthesizer is not currently speaking, calling speak(_:) begins speaking that utterance immediately (or begin waiting through its preUtteranceDelay if one is set). If the synthesizer is speaking, utterances are added to a queue and spoken in the order they are received.

After speech has begun, you can use the synthesizer object to pause or stop speech. After speech is paused, it may be continued from the point at which it left off; stopping ends speech entirely, removing any utterances yet to be spoken from the synthesizer’s queue.

You may monitor the speech synthesizer by examining its speaking and paused properties, or by setting a delegate. Messages in the AVSpeechSynthesizerDelegate protocol are sent as significant events occur during speech synthesis.


Synthesizing Speech

func speak(AVSpeechUtterance)

Enqueues an utterance to be spoken.

Controlling Speech Synthesis

func continueSpeaking() -> Bool

Continues speech from the point at which it left off.

func pauseSpeaking(at: AVSpeechBoundary) -> Bool

Pauses speech at the specified boundary constraint.

var isPaused: Bool

A Boolean value that indicates whether speech has been paused.

var isSpeaking: Bool

A Boolean value that indicates whether the synthesizer is speaking.

func stopSpeaking(at: AVSpeechBoundary) -> Bool

Stops all speech at the specified boundary constraint.

Managing the Delegate

var delegate: AVSpeechSynthesizerDelegate?

The delegate object for the speech synthesizer.


enum AVSpeechBoundary

Constraints describing when speech may be paused or stopped.


Inherits From

Conforms To

See Also

Speech Synthesis Controls

protocol AVSpeechSynthesizerDelegate

Methods you can implement to respond to events that occur during speech synthesis.