为什么我的FreeTTS代码不起作用

时间:2016-05-19 15:12:41

标签: java sql text-to-speech freetts

我想将JTextArea中的文本转换为语音,但我似乎在同一行继续收到错误。

Voice voice;
    VoiceManager vm = VoiceManager.getInstance();
    voice = vm.getVoice(VOICENAME);

    voice.allocate();
    try{
        voice.speak(voice_txt.getText());
    }
    catch (Exception e){
    JOptionPane.showMessageDialog(rootPane, e);}

这是我不断得到的错误

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at FrameTextToSpeech.jButton1ActionPerformed(FrameTextToSpeech.java:75)

错误指向此行

voice.allocate();

0 个答案:

没有答案