System.out.println("Using voice: " + voiceName);
/* The VoiceManager manages all the voices for FreeTTS.
*/
VoiceManager voiceManager = VoiceManager.getInstance();
Voice helloVoice = voiceManager.getVoice(voiceName);
if (helloVoice == null) {
System.err.println(
"Cannot find a voice named "
+ voiceName + ". Please specify a different voice.");
System.exit(1);
}
/* Allocates the resources for the voice.
*/
helloVoice.allocate();
/* Synthesize speech.
*/
// helloVoice.speak("Thank you for giving me a voice. "
// + "I'm so glad to say hello to this world.");
helloVoice.speak("How much wood could a woodchuck chuck if a woodchuck could chuck wood?");
helloVoice.speak("The RDF Schema vocabulary (RDFS)");
/* Clean up and leave.
*/
helloVoice.deallocate();
System.exit(0);
}