Android Programming Press on the image to return to the main documentation page.

TTS

List of types:

TTS

TTS

Synthesizes text to speech and plays it.
After initializing the object you should wait for the Ready event.
See this example.

Events:

Ready (Success As Boolean)

Members:


  Initialize (EventName As String)

  IsInitialized As Boolean

  Pitch As Float [write only]

  Release

  SetLanguage (Language As String, Country As String) As Boolean

  Speak (Text As String, ClearQueue As Boolean)

  SpeechRate As Float [write only]

  Stop

Members description:

Initialize (EventName As String)
Initializes the object.
The Ready event will be raised when the text to speech engine is ready.
EventName - The Sub that will handle the Ready event.
IsInitialized As Boolean
Pitch As Float [write only]
Sets the pitch value. Default is 1.
Example: TTS1.Pitch = 1.5
Release
Releases any resources related to this object. You will need to initialize the object again before use.
Note that it is safe to call this method with an uninitialized object.
SetLanguage (Language As String, Country As String) As Boolean
Sets the spoken language.
Language - Language code. Two lowercase letters.
Country - Country code. Two uppercase letters. Pass an empty string if not needed.
Returns True if a matching language is available. The country value will be ignored if the language code matches and the country code does not match.
Speak (Text As String, ClearQueue As Boolean)
Speaks the given text.
ClearQueue - If True then all waiting texts are dismissed and the new text is spoken.
Otherwise the new text is added to the queue.
SpeechRate As Float [write only]
Sets the speech rate. Default is 1.
Example: TTS1.SpeechRate = 0.5
Stop
Stops speaking any currently playing text (and dismisses texts in the queue).
Top