Instance Method

startSpeaking(_:)

Begins speaking synthesized text through the system’s default sound output device.

Declaration

func startSpeaking(_ string: String) -> Bool

Parameters

text

Text to speak. When nil or empty, no synthesis occurs.

Return Value

true when speaking starts successfully, false otherwise.

Discussion

If the receiver is currently speaking synthesized speech when startSpeaking(_:) is called, that process is stopped before text is spoken.

When synthesis of text finishes normally or is stopped, the message speechSynthesizer(_:didFinishSpeaking:) is sent to the delegate.

See Also

Synthesizing Speech

var isSpeaking: Bool

Indicates whether the receiver is currently generating synthesized speech.

func startSpeaking(String, to: URL) -> Bool

Begins synthesizing text into a sound (AIFF) file.

func pauseSpeaking(at: NSSpeechSynthesizer.Boundary)

Pauses synthesis in progress at a given boundary.

func continueSpeaking()

Resumes synthesis.

func stopSpeaking()

Stops synthesis in progress.

func stopSpeaking(at: NSSpeechSynthesizer.Boundary)

Stops synthesis in progress at a given boundary.

enum NSSpeechSynthesizer.Boundary

These constants are used to indicate where speech should be stopped and paused. See pauseSpeaking(at:) and stopSpeaking(at:).