【发布时间】:2019-10-28 19:33:35
【问题描述】:
我创建了一个完美运行的男声 tts,我的工作代码是,
tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int i) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Voice voiceobj = new Voice("en-us-x-sfg#male_1-local",
Locale.getDefault(), 1, 1, false, null);
tts.setVoice(voiceobj);
String text = "Hai buddy, how are you?";
tts.speak(text, TextToSpeech.QUEUE_FLUSH, null,null);
}
}
});
但我无法将此 tts 保存到 .mp3 或 .wav 之类的文件中。有人知道如何实现这一目标吗?
【问题讨论】: