Search code examples
androidandroid-studiotext-to-speech

How to use different TTS voices for my Android App?


In my app, I want to use different voices to convert text to speech, for example, male and female voices for English US. In the default TTS engine I can only change the pitch which is not enough for me.

I also looked into the TTS docs and found setVoice() but didn't understand how to use it


Solution

  • Unfortunately there is no "default engine" on android, so if you plan to use the TextToSpeech package you won't be able to predict or absolutely dictate exactly what voice is used.

    You basically have three options

    1. Use a cloud based service like google cloud speech

    2. include a full custom TTS in your app code (not easy)

    3. Force the user to use a specific engine by checking that the engine is installed, and if not, prompting to install it

    Or, if you can settle for incomplete control over the voices, then just assume they have the most popular engine (google) and if not, then use default voice.