Re: Text to Speech,help me
Is Central the name of a class, or is it a badly named variable? There's no such class in the standard JDK.
db
Re: Text to Speech,help me
Quote:
Originally Posted by
DarrylBurke
Is Central the name of a class, or is it a badly named variable? There's no such class in the standard JDK.
db
Mind reading once more a pre-requisite. I thought it might be one of the classes in the "Open Mary" project but I can't find either Synthesizer or Central in the Javadoc.
Re: Text to Speech,help me
Thank you,I have had a good solution.Below is my fuction
public void toWavFile(String text, String fileName) {
try {
CGAudioManager audioMan = (CGAudioManager) synth.getAudioManager();
AudioFormat audioFomat = audioMan.getAudioFormat();
AudioFileFormat afm = new AudioFileFormat(AudioFileFormat.Type.WAVE, audioFomat, AudioSystem.NOT_SPECIFIED);
AudioFileSink sink = new AudioFileSink(new File(fileName + ".wav"), afm);
new AudioFormatConverter(audioMan, sink, true);
audioMan.startSending();
synth.speakPlainText(text, null);
synth.waitEngineState(Synthesizer.QUEUE_EMPTY);
audioMan.closeOutput();
sink.drain();
} catch (InterruptedException ex) {
Logger.getLogger(TextToSpeech.class.getName()).log (Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(TextToSpeech.class.getName()).log (Level.SEVERE, null, ex);
} catch (EngineStateError ex) {
Logger.getLogger(TextToSpeech.class.getName()).log (Level.SEVERE, null, ex);
} catch (IllegalArgumentException ex) {
Logger.getLogger(TextToSpeech.class.getName()).log (Level.SEVERE, null, ex);
}
}