The original post in this: http://sourceforge.net/projects/freetts/forums/forum/137669/topic/1166875
To make it easier for you to see, you can simply give the key things to you. Save yourself half a day, hey
The source code is as follows:
public static void main(String[] args) throws InstantiationException {System.setProperty("com.sun.speech.freetts.voice.defaultAudioPlayer", "com.sun.speech.freetts.audio.SingleFileAudioPlayer"); SingleFileAudioPlayer sfap;System.out.println("Using voice: " + "kevin16"); /* The VoiceManager manages all the voices for FreeTTS. */VoiceManager voiceManager = VoiceManager.getInstance();Voice helloVoice = voiceManager.getVoice("kevin16");if (helloVoice == null) {System.err.println("Cannot find a voice named "+ "kevin16" + ". Please specify a different voice.");System.exit(1);} /* Allocates the resources for the voice. */helloVoice.allocate();sfap = (SingleFileAudioPlayer)helloVoice.getDefaultAudioPlayer();helloVoice.setAudioPlayer(sfap);helloVoice.speak("Thank you for giving me a voice. " + "I'm so glad to say hello to this world.");sfap.close();//write data to file at here./* Clean up and leave. */helloVoice.deallocate();System.exit(0);}