Text to speech in MIT App Inventor, with a custom voice
MIT App Inventor makes it easy to build an Android app that talks: drag in the TextToSpeech component and call Speak. The catch is the voice: it is whatever the phone has, and it sounds different on every device.
This guide explains the built-in component, and how to give your app a voice of its own, a character, a narrator or your own voice, using audio files made with the free SuperClonica engine.
The built-in TextToSpeech component
According to the App Inventor reference, TextToSpeech speaks a message with Speak and stops with Stop, and raises BeforeSpeaking and AfterSpeaking events. Pitch and SpeechRate take values from 0 to 2, with 1.0 as normal. Language changes how words are pronounced, not the language spoken: English text with the language set to French sounds like English with a French accent. The available languages and countries depend on the device.
Why the voice changes from phone to phone
The component uses the phone’s own speech engine, so the same app sounds different on different phones, and you cannot pick a specific character or narrator. For a quiz, a game or a talking assistant with a recognisable voice, play recorded audio instead.
A custom voice with audio files
Voice the app’s fixed lines with the free SuperClonica engine: install it with python -m pip install superclonica-cpu and run, for example, superclonica --text "Well done! Next level." --voice voice.json --lang en --normalize --output well_done.wav. Upload the files as Media in the Designer. The reference recommends the Sound component for short files such as effects and phrases and the Player component for longer ones; set the Source and call Play. Hear voices free on their pages with 30 to 100 characters first.
Text that changes at runtime
For text you only know while the app runs, such as a user’s name, the Web component can send the text to the SuperClonica speech API with your key, save the answer to a file with SaveResponse and hand it to a Player. A free key gives 3 minutes of audio a day; the request format is in the Speech API section of your workspace. Keep the built-in TextToSpeech as a fallback when the phone is offline.
Ideas for school projects
Talking flashcards, a quiz host, a reading buddy or a game narrator all work well with a few dozen prepared lines. Use one voice and seed for all files so the app always sounds the same. The engine speaks 31 languages; Chinese is not supported yet. Character voices in the catalog are fan-made, so keep projects with them non-commercial.