【问题标题】:Text to Speech(TTS) - Android - Portuguese文字转语音 (TTS) - Android - 葡萄牙语
【发布时间】:2016-04-07 01:17:50
【问题描述】:

我正在尝试使用 android 应用程序复制一些文本,以帮助视障人士,尤其是使用 TTS,但在我的情况下,我需要说葡萄牙语-巴西语,并且 TTS 类没有可用的葡萄牙语作为语言环境。有谁知道如何实现葡萄牙语巴西阅读器?

我使用的是 Android Studio,MinSDK 是 15。

...

tts = new TextToSpeech (this, this);

tts.setLanguage(Locale.[X]);

...

tts.speak("Muito obrigado a todos!", TextToSpeech.QUEUE_FLUSH, null);

...

【问题讨论】:

标签: android audio android-studio text-to-speech


【解决方案1】:

您是如何创建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);
        }
    }
}

【讨论】:

    【解决方案2】:

    解决了!我的问题是设备上没有安装 TTS。所以,就从谷歌商店安装它(https://play.google.com/store/apps/details?id=com.google.android.tts&hl=en)。

    【讨论】: