如何从 android studio 中的 Text To Speech 获取所有支持的语音列表
how to get list all supported voices from Text To Speech in 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"
根据doc
getVoices()
方法来自 TextToSpeech
returns 所有可用声音的集合。
我正在研究 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"
根据doc
getVoices()
方法来自 TextToSpeech
returns 所有可用声音的集合。