Components
keyboard_arrow_up
Add
Text to speech
-
Description
- You can specify a country by supplying a country code, this can affect the pronunciation. For example, British English (GBR) will sound differently than US English. UU (EE. UU.). Not all country codes will affect all languages.
- The languages and countries available depend on the particular device, and can list with the properties' Available Languages' and 'Countries available. In the properties of the component you can see the options.
Text to speech
The text-to-speech component is a component that allows Play a text out loud, this changes the pronunciation of the words, not the actual spoken language. For example, set the language to French and speak in English it will look like someone speaks English (en) with a French accent.
-
Events
- After speaking
- This event is activated when the message is played.
- Before speaking
- This event is triggered when the 'Speak' procedure is called, before that the message is reproduced.
-
Procedures
- Speak
- This method, reproduces the text message provided.
-
Properties
- Available countries
- This property provides a list of available country codes on the device for use with the Text-to-Speech component. Consult the Android developer documentation in the supported languages for find the meaning of these abbreviations.
- Available languages
- This property provides a list of the languages available in the device to use with the Text-to-Speech component. Consult the Android developer documentation in the supported languages for find the meaning of these abbreviations.
- Country
- This property provides us with the country code to use in the Text to speech component. This can affect the pronunciation. For example, British English (GBR) will sound different from the English of EE UU (USA). Not all country codes will affect all languages.
- Language
- This property sets the language for Text to Speech. This changes the way the words are pronounced, not the actual language spoken. For example, setting the language in French and speaking in English will sound like someone I spoke English with a French accent.
- Pitch
- Allows you to set the pitch for the Text to Speech component. The values must be between 0 and 2, where the lowest values decrease the pitch of the voice and the higher ones increase the pitch.
- Result
- This property provides us with the audio file originated at transform the text to voice.
- Speech rate
- This property sets the speech speed for the Text component to voice. Values must be between 0 and 2, where lower values slow down the voice pitch and the higher values accelerate it.
-
Example
- From text to speech
- This example is very simple, we are only going to use two components, a button and the Text to Speech component.
We have to configure the language and the country. We can do it in the properties or in the block editor.
Now we just write something and press the button, we will hear the text in audio.