Now you can use the male / female voice and dynamically change it from the user interface of the application. Define a TTS like this (add the google tts engine to the constructor):
tts = new TextToSpeech(context, this, "com.google.android.tts");
contex = activity / app
this = TextToSpeech.OnInitListener
In the tts.getVoices() list, select the desired voice by name:
for (Voice tmpVoice : tts.getVoices()) { if (tmpVoice.getName().equals(_voiceName)) { return tmpVoice; break; } }
NB: U need to set _voiceName , getting a hard-coded voice name from tts.getVoices() . for example: for an English man it would be: "en-us-x-sfg # male_1-local"
source share