Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the default voice of Android's Text To Speech

I'm using the Android's Text To Speech default engine in my app, however the female's voice sounds like a woman over 40 and her voice is somewhat robotic.

I saw other apps that seems to use Google's built in TTS, but it sounds a lot better i.e young woman with a more natural voice.

That "natural" voice is also being used in the Android main Google Search e.g. when you press on the mic and ask a question (Siri style) like "who is the president of the US", the woman's voice will tell you the answer.

How can this voice be achieved in the code?

Basically this is what I do in my code:

    TextToSpeech tts = new TextToSpeech(this, this);
          .
          .
          .
    tts.setLanguage(Locale.US);
    tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
like image 663
GarnerK Avatar asked Jul 29 '13 00:07

GarnerK


People also ask

How do I change the voice on Google text to speech on Android?

In the "Accessibility" section, select Manage accessibility features. Open Select-to-speak settings. Customize your Select-to-speak voice: Change the language and preferred voice: Under “Speech," choose the language and type of voice you want to hear.

How do I change the voice on Google text to speech?

To access the Accessibility features on your Android device open the Settings app . In the Settings app, select Accessibility from the list. On the Accessibility screen, scroll down to the Screen readers section and select Text-to-speech output.

How do I change the male voice on Google text to speech?

You cannot make the Android TextToSpeech sounds like a male. If you change the TextToSpeech. setPitch() value to something low, like 0.1, it will sound very bad. Your only option is to try another Text-to-Speech engine, or live with the female sounding voice.


1 Answers

Here is my code to use KEY_FEATURE_NETWORK_SYNTHESIS param:

HashMap<String, String> onlineSpeech = new HashMap<>();
onlineSpeech.put(TextToSpeech.Engine.KEY_FEATURE_NETWORK_SYNTHESIS, "true");
tts.speak(speech, TextToSpeech.QUEUE_FLUSH, onlineSpeech);
like image 127
emadabel Avatar answered Sep 25 '22 03:09

emadabel