如何在android studio中从文本到语音获取所有支持的声音列表
我正在研究 TTS(文本转语音)。我想获取支持的声音列表,我该怎么办 示例:
private TextToSpeech t1;
t1 = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status != TextToSpeech.ERROR) {
t1.setLanguage(Locale.US);
}
}
});
t1.setLanguage(Locale.US);
Voice va=new Voice("en-gb-x-rjs#female_2-local",new
Locale("en","US"),400,200,true,a);
t1.setVoice(va);
String toSpeak = textTitle.getText().toString();
t1.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
我希望将所有列表作为
“en-gb-x-rjs#female_2-local”
I am working on TTS (Text to Speech). And I want to get the list of supported voices, what should I do
EXAMPLE:
private TextToSpeech t1;
t1 = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status != TextToSpeech.ERROR) {
t1.setLanguage(Locale.US);
}
}
});
t1.setLanguage(Locale.US);
Voice va=new Voice("en-gb-x-rjs#female_2-local",new
Locale("en","US"),400,200,true,a);
t1.setVoice(va);
String toSpeak = textTitle.getText().toString();
t1.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
I want have all list as
"en-gb-x-rjs#female_2-local"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 doc
getVoices()TextToSpeech
中的 code> 方法返回所有可用语音的集合。As per doc
getVoices()
method fromTextToSpeech
returns set of all the available voices.