javanetbeansfreetts

Freetts is not working when bundled with the java application


I have developed a java application in Netbeans IDE that announces the token numbers using Freetts. My application works perfectly when I ran it(as you know Netbeans adds the library files in a separate folder called 'lib' beside the java application). But Throws Null Pointer Exception When Bundled the libraries Together with the application. Please suggest me some help. Or is there any other free simple speech synthesizers??


Solution

  • Thank you for your suggestions, but I found the answer Myself!

    The reason for the deployment problem is because freetts.jar load voiceDirectory at runtime which needs a voices.txt file.When I rebundled it along with my application, this voices.txt file is not included. Hence I used the kal voice package in the following way:

    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();
    

    Here I manually load the voices from the voicedirectory class instead from a text file.