我正在尝试使用TTS朗读整个圣经章节。问题是,它失败了,因为文本长度很大。
textToSpeech = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int ttsLang = textToSpeech.setLanguage(Locale.US);
if (ttsLang == TextToSpeech.LANG_MISSING_DATA
|| ttsLang == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TTS", "The Language is not supported!");
} else {
Log.i("TTS", "Language Supported.");
}
Log.i("TTS", "Initialization success.");
} else {
Toast.makeText(getApplicationContext(), "TTS Initialization failed!", Toast.LENGTH_SHORT).show();
}
}
});
}
public void speak(View view) {
int speechStatus = textToSpeech.speak(data, TextToSpeech.QUEUE_FLUSH, null);
if (speechStatus == TextToSpeech.ERROR) {
Toast.makeText(getApplicationContext(), "TTS conversion failure", Toast.LENGTH_SHORT).show();
Log.e("TTS", "Error in converting Text to Speech!");
}
}
我该如何解决?
我在日志Log.e("TTS", "Error in converting Text to Speech!");
中得到了