Skip Navigation
Class

AVSpeechSynthesizer

An object that produces synthesized speech from text utterances and enables monitoring or controlling of ongoing speech.
class AVSpeechSynthesizer

Overview

To speak some text, create an AVSpeechUtterance instance that contains the text and pass it to speak(_:) on a speech synthesizer instance. You can optionally also retrieve an AVSpeechSynthesisVoice and set it on the utterance’s voice property to have the speech synthesizer use that voice when speaking the utterance’s text.

The speech synthesizer maintains a queue of utterances that it speaks. If the synthesizer isn’t speaking, calling speak(_:) begins speaking that utterance either immediately or after pausing for its preUtteranceDelay, if necessary. If the synthesizer is speaking, the synthesizer adds utterances to a queue and speaks them in the order it receives them.

After speech begins, you can use the synthesizer object to pause or stop speech. After pausing, you can resume the speech from its paused point or stop the speech entirely and remove all remaining utterances in the queue.

You can monitor the speech synthesizer by examining its isSpeaking and isPaused properties, or by setting a delegate that conforms to AVSpeechSynthesizerDelegate. The delegate receives significant events as they occur during speech synthesis.

An AVSpeechSynthesizer also controls the route where the speech plays. For more information, see Directing speech output.

Topics

Current page is AVSpeechSynthesizer