Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android text to speech in different languages

I want to make an application that can support different languages.

There is no problem with the "default" languages:

tts.setLanguage(Locale.ENGLISH);

And also some other:

Locale l = new Locale("ru","RU");
tts.setLanguage(l);

But a lot of others don't work, eg.:

Locale l = new Locale("hu","HU");
tts.setLanguage(l);

I have also tried "hu", "hu-HU", "hu-rHU", "HU"... but nothing...

Also, it doesn't work with Turkish, Greek, Dutch, Czech...

like image 541
ferrari13 Avatar asked Nov 26 '15 17:11

ferrari13


People also ask

How do I get different text-to-speech voices on Android?

Select Text-to-Speech voice settings. Under "Speech Engines," next to "Acapela TTS Engine," select Settings. Select the voice(s) you want to purchase. Return to Text-to-Speech voice settings and under "Preferred Voices," choose the voice you want to use.

What is TTS feature in Android?

android.speech.tts.TextToSpeech. Synthesizes speech from text for immediate playback or to create a sound file. A TextToSpeech instance can only be used to synthesize text once it has completed its initialization. Implement the TextToSpeech. OnInitListener to be notified of the completion of the initialization.


1 Answers

Not all are supported, use: Locale.getAvailableLocales() to get available possible locales and test them against isLanguageAvailable, or since api21 you can use getAvailableLanguages() to directly get available languages for current TTS engine. You can install alternative TTS engine, ie. SVOX is quite good.

like image 58
marcinj Avatar answered Nov 04 '22 19:11

marcinj