Search code examples
androidtext-to-speech

How to change voice in Text to Speech Recognization?


I create Text to Speech application which work normally but my problem is that i need
to change voice nation wise.Suppose now speech in U.S. English and i want to convert it in Indian language.And also from women voice to men voice.
I try to find relevant answer but i didn't found anything.Please provide me some link,
Tutorial or code.
Thanks in Advance.


Solution

  • You cannot change the voice of Android Text to Speech. You can use TextToSpeech.setPitch(), however it only distorts the voice.

    You can change the language TextToSpeech uses language by using TextToSpeech.setLanguage(). Just pass in the Locale of the language you want to use.

    You can also set the language of the SpeechRecognizer to be any language you want such as English.

    In terms of getting things working, here is my example code that uses both TextToSpeech and SpeechRecognition.

    Sample code