Skip to content

Text To Speech

Non-Visible component
Category Requires Version
Media API 21, Android 5.0 Lollipop 5

Overview

The TestToSpeech component speaks a given text aloud. You can set the pitch and the rate of speech.

You can also set a language by supplying a language code. This changes the pronounciation of words, not the actual language spoken. For example, setting the language to French and speaking English text will sound like someone speaking English (en) with a French accent.

You can also specify a country by supplying a country code. This can affect the pronounciation. For example, British English (GBR) will sound different from US English (USA). Not every country code will affect every language.

The languages and countries available depend on the particular device, and can be listed with the AvailableLanguages and AvailableCountries properties.

Events

After Speaking

Event to raise after the message is spoken.

Params
result Boolean

Before Speaking

Event to raise when Speak is invoked, before the message is spoken.

Methods

Speak

Speaks the given message.

Params
message Text

Properties

Available Countries

List ➖ Read - Blocks

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.

Available Languages

List ➖ Read - Blocks

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.

Country

Text ➖ Read Write - Designer Blocks

Country code to use for speech generation. This can affect the pronounciation. For example, British English (GBR) will sound different from US English (USA). Not every country code will affect every language.

Language

Text ➖ Read Write - Designer Blocks

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 and speaking English text with sound like someone speaking English with a French accent.

Pitch

Number Default: 1.0 ➖ Read Write - Designer Blocks

Sets the Pitch for TextToSpeech The values should be between 0 and 2 where lower values lower the tone of synthesized voice and greater values raise it.

Result

Boolean ➖ Read - Blocks

Result property getter method.

Speech Rate

Number Default: 1.0 ➖ Read Write - Designer Blocks

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.


Last update: November 9, 2022