A distinct voice for use in speech synthesis.


class AVSpeechSynthesisVoice : NSObject


In speech synthesis, voices are distinguished primarily by language, locale, and quality. Use this class to select a voice appropriate to the language of text to be spoken, or to select a voice exhibiting a particular local variant of that language (such as Australian or South African English).

To select a voice for use in speech, obtain an AVSpeechSynthesisVoice instance using one of the methods in Finding Voices, and then set it as the value of the voice property on an AVSpeechUtterance instance containing text to be spoken. For a complete list of supported languages, see Languages Supported by VoiceOver.


Finding Voices

init?(identifier: String)

Returns a voice object for the specified identifier.

init?(language: String?)

Returns a voice object for the specified language and locale.

let AVSpeechSynthesisVoiceIdentifierAlex: String

The voice object identified as Alex.

Identifying Voices

var identifier: String

The unique identifier for a voice object.

var name: String

The name for a voice object.

var quality: AVSpeechSynthesisVoiceQuality

The speech quality for a voice object.

enum AVSpeechSynthesisVoiceQuality

The voice object's speech quality.

Working with Language Codes

class func currentLanguageCode() -> String

Returns the code for the user’s current locale.

var language: String

A BCP 47 code identifying the voice’s language and locale.


Inherits From

See Also

Spoken Text Attributes

class AVSpeechUtterance

A chunk of text to be spoken, along with parameters that affect its speech.