TextToSpeechEngine
public protocol TextToSpeechEngine
TextToSpeechEngine provides interface of the text to speech engine.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Defines supported alphabets of the phonetic transcriptions.
Declaration
Swift
var supportedAlphabets: [String] { get }
-
A delegate to respond to events that occur during playback.
Declaration
Swift
var delegate: TextToSpeechEngineDelegate? { get set }
-
A locale that defines the voice’s language.
Declaration
Swift
var locale: Locale? { get }
-
Initializes vocalization of the message.
- message: The
TTSMessage
that contains text message and options, that define how the message should be handled.
Declaration
Swift
func play(message: TTSMessage)
- message: The
-
Immediately stops the playback.
Declaration
Swift
func stop()
-
Sets the audio volume to one of the predefined levelas.
Declaration
Swift
func setVolume(_ volume: SpeechVolume)
Parameters
volume
One of the predefined volume levels.
-
Sets the language code of the messages.
Declaration
Swift
func changeLocale(with locale: Locale)
Parameters
locale
A new locale parameter to change locale .
-
Checks if the specified voice’s language is available on the device.
Declaration
Swift
func isLanguageAvailable(for locale: Locale) -> Bool
Parameters
locale
Locale used to identify the language
Return Value
true
if the specified language is available,false
otherwise.