Android Google TTS - select voice variant programmatically

六眼飞鱼酱① 提交于 2019-12-11 11:41:57

问题


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:


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



来源:https://stackoverflow.com/questions/22917260/android-google-tts-select-voice-variant-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!