Android Google TTS - select voice variant programm

2019-08-07 01:19发布

Google TTS voices on Android, at least for some language/country pairs, come with male and female variants - for example English United Kingdom, has both low and high quality male and female voices. Yet the Google TTS engine, when enumerating voices with TextToSpeech.Engine.ACTION_CHECK_TTS_DATA intent, lists only language-country locales, without the variant, e.g. eng-gbr, eng-usa.

When calling the tts.setLanguage(locale), I tried adding the variant like "eng-gbr-male" or "eng-gbr-Male", but they ignore this, always returning the value 1 (language and region available, variant not). Is there any way to set the male or female variant programmatically for Google TTS voices, from a normal app without a root access?

Greg

1条回答
地球回转人心会变
2楼-- · 2019-08-07 01:51

As of API 21, you can use the TextToSpeech.setVoice() method.

查看更多
登录 后发表回答