我想调用java程序,它是文本到语音转换器,我想从jsp页面发送文本

时间:2014-04-03 06:23:04

标签: java jsp servlets java-api

这是java文本到语音文件,我想在jsp中将此文件调用到传递参数中,并将该文件调用到此文件中并在jsp文件上执行检索结果

public class TextSpeech 
{
     public static void main(String[] args){
        try
        {
            System.setProperty("freetts.voices",
               "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
            Central.registerEngineCentral
               ("com.sun.speech.freetts.jsapi.FreeTTSEngineCentral");
            Synthesizer  synthesizer =
               Central.createSynthesizer(new SynthesizerModeDesc(Locale.US));
            synthesizer.allocate();
            synthesizer.resume();
            synthesizer.speakPlainText("Can you hear me now?", null);
            synthesizer.waitEngineState(Synthesizer.QUEUE_EMPTY);
            synthesizer.deallocate();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
     }
}

0 个答案:

没有答案