Instance Method

speechSynthesizer(_:willSpeakRangeOfSpeechString:utterance:)

Tells the delegate when the synthesizer is about to speak a portion of an utterance’s text.

Declaration

optional func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, willSpeakRangeOfSpeechString characterRange: NSRange, utterance: AVSpeechUtterance)

Parameters

synthesizer

The synthesizer speaking the utterance that this message applies to.

characterRange

The range of characters in the utterance’s speechString corresponding to the unit of speech about to be spoken.

utterance

The utterance currently being spoken.

Discussion

Because this delegate message is sent once for each unit of speech (generally, a word) in the utterance’s text, you can use it for such purposes as highlighting each word onscreen as it is spoken.

See Also

Responding to Speech Synthesis Events

func speechSynthesizer(AVSpeechSynthesizer, didCancel: AVSpeechUtterance)

Tells the delegate when the synthesizer has canceled speaking an utterance.

func speechSynthesizer(AVSpeechSynthesizer, didContinue: AVSpeechUtterance)

Tells the delegate when the synthesizer has resumed speaking an utterance after being paused.

func speechSynthesizer(AVSpeechSynthesizer, didFinish: AVSpeechUtterance)

Tells the delegate when the synthesizer has finished speaking an utterance.

func speechSynthesizer(AVSpeechSynthesizer, didPause: AVSpeechUtterance)

Tells the delegate when the synthesizer has paused while speaking an utterance.

func speechSynthesizer(AVSpeechSynthesizer, didStart: AVSpeechUtterance)

Tells the delegate when the synthesizer has begun speaking an utterance.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software