[Android] TTS TextToSpeech Extension [0.2]


  • Posts: 1502
Text To Speech Extension for Android
Version 0.2

Platforms : All android from version 2.3
Close future : no others.
Far far far far future : who knows maybe IOS windows and Linux ?

Future Planned Improvements
Close Future :
  • block to get installed engines working
  • if possible, event to trigger when text said
  • chose engine to start ( you could use real engines that accept SSML)
  • create sound file from TTS
  • (easy) Combine the say text add and add to playlist into one block
  • earcons for android > 5.0
  • remove useless imports
  • remove useless trace, print

Code: [Select]
- combined multiple blocks
- trigger event when TTS has finished processed sentence

Feedback needed
If somebody has an Android >= 5.0 Lollipop, I'm super interested to see if it works and would love to make a special test
which I'll explain later
On earcpns, if somebody is able to make it work.

Advice welcomed !!
On the code, colour blocks, blocks names ....
If somebody knows why onActivityResult doesn't work ....

Special Thanks
To Justin,  for his help with complex ( for me) code
To Mdotedot, for his help in testing and reading my posts.

How to use it

You have to start engine or set language.
After about 2 seconds, you can begin to use the engine. ( so put the say text block into a after 2 seconds block, if you use it directly after starting the engine).

Non Blocks

When TTS has finished playing text, set game attribute  TTSLastSaidText to last said text
and trigger event in scene TTSHasFinishedPlaying

Blocks :

Action Blocks

1 sayText Flush/Queue
input : String
The speech engine will say the text.
Flush : instantly
Queue : will put the text in the queue

4 setLanguageLocale to  .. or .. or
input: You can choose variant or language or type the id of the locale
It will check if the used TTS engine has the locale which begins with the letters written. For example for French, you can type French, Fr, F. If you want to have a specific French you'll have to type Fr-CA. If FR_CA isn't proposed , it will use Fr.  If Fr isn't installed , it will propose to install it .  It takes about 2 seconds.
It will restart engine.

5 setPitch
input : float
Normal pitch is 1.

6 setSpeechRate
input : float
Normal pitch is 1

10 Close Engine
Closes engine. Saves memory.

11  Stop Engine
??? Normally to stop engine and flush queue. ( But you just use say text with an empty string) But whenever I use it I cannot say anything afterwards.

12 Map string of text ...  sound path …
input : String .. String ( <--a path)

For now, only in Android before Lollipop 5
You must use Add earcon to play it.

Should work, but I have no idea how to use it, if somebody knows.

13 Add earcon to playlist …
input : String

Adds earcon to playlist.   

For now, only in Android before Lollipop 5
Should work, but I have no idea how to use it, if somebody knows.

Normal Blocks

7 isSpeaking
output : boolean

8 getLangAvailable id/names
Takes One Second. Returns  or the ids or the display names of the languages available on the engine. Engine must be started to use.
output : List

Heberger image
3 Installed engines
Returns installed engines

output: trace for now

Download Link
Download attached ( only member of forum can see)

« Last Edit: September 24, 2015, 08:25:06 am by yoplalala »


  • *
  • Posts: 2182
Amazing :) ! I was always looking for something like this! Any plans for flash ?


  • Posts: 1502
No, not for flash. I don't think it's possible , but maybe for HTML5?


  • Posts: 1502
Bumping for new version


  • *
  • Posts: 683
Bumping for a version that works on HTML!


  • Posts: 1502
Hmm, i could see. In fact I am using an improved version of this extension which does HTML and windows and kind of linux too. But I have to clean it before I can publish too. Do you need it for some specific date ?


  • Posts: 1506
Awesome!  I forgot about this.  I'd love to try it out when its ready...  can you get thep mic output value as an attribute!?  Then we have mic controls on Android!  I got flash mic controls working years ago.  Haven't tried an extension though