TextToSpeech Component


Properties

availableCountries
  List of the country codes available on this device for use with TextToSpeech. Check the Android developer documentation under supported languages to find the meanings of these abbreviations.
Data type: array
Designer Writable false
Code Writeable false
Code Readable true let variable = texttospeechName.availableCountries

availableLanguages
  List of the languages available on this device for use with TextToSpeech. Check the Android developer documentation under supported languages to find the meanings of these abbreviations.
Data type: array
Designer Writable false
Code Writeable false
Code Readable true let variable = texttospeechName.availableLanguages

country
  Country code to use for speech generation. This can affect the pronunciation. For example, British English (GBR) will sound different from US English (USA). Not every country code will affect every language. This is normallt a 3 character uppercase string.
Data type: string
Designer Writable true <texttospeech name="texttospeechName" country="AUS">
Code Writeable true texttospeechName.country = "AUS"
Code Readable true let variable = texttospeechName.country

language
  Sets the language for TextToSpeech. This changes the way that words are pronounced, not the actual language that is spoken. For example, setting the language to French and speaking English text will sound like someone speaking English with a French accent. This normally a 2 character lowercase string.
Data type: string
Designer Writable true <texttospeech name="texttospeechName" language="en">
Code Writeable true texttospeechName.language = "en"
Code Readable true let variable = texttospeechName.language

pitch
  Sets the speech pitch for the TextToSpeech. The values should be between 0 and 2 where lower values lower the tone of synthesized voice and greater values raise it. The default value is 1.0 for normal pitch.
Data type: number
Designer Writable true <texttospeech name="texttospeechName" pitch="1.05">
Code Writeable true texttospeechName.pitch = 1.05
Code Readable true let variable = texttospeechName.pitch

result
  Returns true{
Data type: boolean
Designer Writable false
Code Writeable false
Code Readable true let variable = texttospeechName.result

speechRate
  Sets the SpeechRate for TextToSpeech. The values should be between 0 and 2 where lower values slow down the pitch and greater values accelerate it. The default value is 1.0 for normal speech rate.
Data type: number
Designer Writable true <texttospeech name="texttospeechName" speechRate="1">
Code Writeable true texttospeechName.speechRate = 1
Code Readable true let variable = texttospeechName.speechRate

class
  The styling class of the the component
Data type: string
Designer Writable true <texttospeech name="texttospeechName" class="Test class">
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true <texttospeech name="texttospeechName" id="Test id">
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true <texttospeech name="texttospeechName" name="testComponent">
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
speak Speaks the given message.
texttospeechName.speak(message)
texttospeechName.speak("Test message")
message string
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
afterSpeaking Event to raise after the message is spoken. The result will be true if the message is spoken successfully, otherwise it will be false.
texttospeechName.addEventListener(
    "afterSpeaking",
    function (result) {
        //Your code here
    }
)
result boolean
beforeSpeaking Event to raise when Speak is invoked, before the message is spoken.
texttospeechName.addEventListener(
    "beforeSpeaking",
    function () {
        //Your code here
    }
)