Android Google TTS - 以编程方式选择语音变体 [英] Android Google TTS - select voice variant programmatically
问题描述
Android 上的 Google TTS 语音,至少对于某些语言/国家/地区对,带有男性和女性变体 - 例如英国英语,具有低质量和高质量的男性和女性声音.然而,当使用 TextToSpeech.Engine.ACTION_CHECK_TTS_DATA 意图枚举语音时,Google TTS 引擎仅列出语言国家/地区的语言环境,而没有变体,例如eng-gbr, eng-usa.
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.
在调用 tts.setLanguage(locale) 时,我尝试添加诸如eng-gbr-male"或eng-gbr-Male"之类的变体,但他们忽略了这一点,始终返回值 1(可用的语言和区域),变体不是).有没有办法从没有 root 访问权限的普通应用程序中以编程方式为 Google TTS 语音设置男性或女性变体?
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?
格雷格
推荐答案
从 API 21 开始,您可以使用 TextToSpeech.setVoice() 方法.
As of API 21, you can use the TextToSpeech.setVoice() method.
这篇关于Android Google TTS - 以编程方式选择语音变体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!