文字转语音 (TTS) - Android - 葡萄牙语
Text to Speech(TTS) - Android - Portuguese
我正在尝试使用 android 应用程序复制一些文本,这将帮助视障人士,尤其是 TTS,但就我而言,我需要说巴西葡萄牙语,并且 TTS class 没有可用的葡萄牙语语言环境。有谁知道如何实施葡萄牙语巴西 reader?
我正在使用 Android Studio,MinSDK 是 15。
...
tts = new TextToSpeech (this, this);
tts.setLanguage(Locale.[X]);
...
tts.speak("Muito obrigado a todos!", TextToSpeech.QUEUE_FLUSH, null);
...
你是怎么做到 onInitListener()
的?当您调用 tts = new TextToSpeech (this, this);
时,onInitListener()
会将 TextToSpeech 服务连接到您的 tts
实例。因此,如果您尝试设置语言或说出声音,请检查此值:
tts = new TextToSpeech (this, this);
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int res = tts.setLanguage(Locale.[X]);
if (res >= TextToSpeech.LANG_AVAILABLE) {
// Then, you can speak with your locale.
// Call speak() in here or after this method.
tts.speak("Muito obrigado a todos!", TextToSpeech.QUEUE_FLUSH, null);
}
}
}
已解决!我的问题是设备上没有安装 TTS。所以,刚从 google 商店 (https://play.google.com/store/apps/details?id=com.google.android.tts&hl=en).
安装了它
我正在尝试使用 android 应用程序复制一些文本,这将帮助视障人士,尤其是 TTS,但就我而言,我需要说巴西葡萄牙语,并且 TTS class 没有可用的葡萄牙语语言环境。有谁知道如何实施葡萄牙语巴西 reader?
我正在使用 Android Studio,MinSDK 是 15。
...
tts = new TextToSpeech (this, this);
tts.setLanguage(Locale.[X]);
...
tts.speak("Muito obrigado a todos!", TextToSpeech.QUEUE_FLUSH, null);
...
你是怎么做到 onInitListener()
的?当您调用 tts = new TextToSpeech (this, this);
时,onInitListener()
会将 TextToSpeech 服务连接到您的 tts
实例。因此,如果您尝试设置语言或说出声音,请检查此值:
tts = new TextToSpeech (this, this);
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int res = tts.setLanguage(Locale.[X]);
if (res >= TextToSpeech.LANG_AVAILABLE) {
// Then, you can speak with your locale.
// Call speak() in here or after this method.
tts.speak("Muito obrigado a todos!", TextToSpeech.QUEUE_FLUSH, null);
}
}
}
已解决!我的问题是设备上没有安装 TTS。所以,刚从 google 商店 (https://play.google.com/store/apps/details?id=com.google.android.tts&hl=en).
安装了它