Contents

startSpeaking(_:to:)

Begins synthesizing text into a sound (AIFF) file.

Declaration

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

Parameters

  • string:

    Text to speak. When nil or empty, no synthesis is started.

  • url:

    Filesystem location of the output sound file.

Return Value

true when synthesis starts successfully, false otherwise.

Discussion

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

One example of how you might use this method is in an email program that automatically converts new messages into sound files that can be stored on an iPod for later listening.

See Also

Synthesizing Speech