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
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
Use a cloud based service like google cloud speech
include a full custom TTS in your app code (not easy)
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.