About me

My name is Marko Markovic and I am a software developer, a musician and a researcher. I am intrigued by algorithms and new techniques and I want to improve my software development skills.

While working on different projects I like to document what I have learned. A new technique, a new algorithm, solution to a problem or a tool. The reason I am writing this blog is to help out other people in their programming endeavors and also I write so I won't forget.

If you are interested to find out more about me visit markomarks.com

Saturday, February 23, 2013

Text To Speech gender?

Hiya there, how are you today? After losing a lot of time trying to find out a way to get a male voice for the default android text-to-speech, I finally found a solution that will satisfy me. But for now :P. The only way I could accomplish gender change (for English languages only) in Android's Text-To- Speech API was using the 'setLanguage' method. Of course, there is a way with handling the pitch of the text-to-speech but the results are kinda nasty if you ask me.


if(myTTS.isLanguageAvailable(Locale.ENGLISH)==TextToSpeech.LANG_AVAILABLE)
myTTS.setLanguage(Locale.UK);

Or
if(myTTS.isLanguageAvailable(Locale.ENGLISH)==TextToSpeech.LANG_AVAILABLE)
myTTS.setLanguage(Locale.US);

The default text-to-speech engine has a male voice for the UK setting and a female voice for the US setting. This only a temporary fix, as I have read somewhere on the jelly bean 4.2 a new voice will be introduced for the text-to-speech. We will see what it offers.

That's it for now
Until next time

Update: This solution doesn't work on all android versions, looks like newer versions contain only female voice packs. We are stuck without a choice for a while.

No comments:

Post a Comment

Blog Archive