与 java 应用程序捆绑时,Freetts 不工作
Freetts is not working when bundled with the java application
我在 Netbeans IDE 中开发了一个 java 应用程序,它使用 Freetts 宣布令牌号。我的应用程序在 运行 时完美运行(如您所知,Netbeans 在 java 应用程序旁边的名为 'lib' 的单独文件夹中添加了库文件)。但是当将库与应用程序捆绑在一起时会抛出空指针异常。请给我一些帮助。或者有没有其他免费的简单语音合成器??
感谢您的建议,但我自己找到了答案!
部署问题的原因是因为 freetts.jar 在运行时加载 voiceDirectory 需要 voices.txt file.When 我将它与我的应用程序一起重新绑定,这个 voices.txt 文件不包括在内。因此,我通过以下方式使用了 kal 语音包:
VoiceDirectory vd = new KevinVoiceDirectory();
Voice voices = vd.getVoices();
Voice helloVoice = voices;
helloVoice.allocate();
/*
* Synthesize speech.
*/
helloVoice.speak("Thank you for giving me a voice. "
+ "I'm so glad to say hello to this world.");
/*
* Clean up and leave.
*/
helloVoice.deallocate();
这里我手动从语音目录 class 加载语音,而不是从文本文件加载。
我在 Netbeans IDE 中开发了一个 java 应用程序,它使用 Freetts 宣布令牌号。我的应用程序在 运行 时完美运行(如您所知,Netbeans 在 java 应用程序旁边的名为 'lib' 的单独文件夹中添加了库文件)。但是当将库与应用程序捆绑在一起时会抛出空指针异常。请给我一些帮助。或者有没有其他免费的简单语音合成器??
感谢您的建议,但我自己找到了答案!
部署问题的原因是因为 freetts.jar 在运行时加载 voiceDirectory 需要 voices.txt file.When 我将它与我的应用程序一起重新绑定,这个 voices.txt 文件不包括在内。因此,我通过以下方式使用了 kal 语音包:
VoiceDirectory vd = new KevinVoiceDirectory();
Voice voices = vd.getVoices();
Voice helloVoice = voices;
helloVoice.allocate();
/*
* Synthesize speech.
*/
helloVoice.speak("Thank you for giving me a voice. "
+ "I'm so glad to say hello to this world.");
/*
* Clean up and leave.
*/
helloVoice.deallocate();
这里我手动从语音目录 class 加载语音,而不是从文本文件加载。