【发布时间】:2013-07-02 17:19:15
【问题描述】:
我的应用程序中有这段文本到语音的代码。
public void onInit(int status) {
// TODO Auto-generated method stub
if (status == TextToSpeech.SUCCESS) {
//Setting speech language
int result = tts.setLanguage(Locale.ENGLISH);
//If your device doesn't support language you set above
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
//Cook simple toast message with message
Toast.makeText(this, "Language not supported", Toast.LENGTH_LONG).show();
//Log.e("TTS", "Language is not supported");
}
//TTS is not initialized properly
} else {
Toast.makeText(this, "TTS Initilization Failed", Toast.LENGTH_LONG).show();
//Log.e("TTS", "Initilization Failed");
}
}
我的应用程序包括许多不同的语言,如英语、印地语、马拉地语、泰卢固语、泰米尔语等。由于默认的 android tts 引擎不支持这些语言,我从link 下载了 eSpeak tts 引擎并将其安装在我的手机上.
它的默认语言设置为英语。如何在我的代码中更改它的语言,以便它也可以读取其他语言的 unicode 文本?
目前,对于印地语中的单词,它会说出一些数字。
如何让它识别文本中使用的语言?它仅显示默认 google tts 中可用的语言环境。如何将 tts 引擎更改为 eSpeak tts?
【问题讨论】:
-
哪里可以解决这个问题。你能分享一个相同的示例代码吗?
-
@SSR No.. 我无法解决它.. 它没有检测到 espeak 引擎。
标签: android unicode text-to-speech