tags:

views:

62

answers:

0

import javax.speech.EngineList; import javax.speech.EngineCreate; import javax.speech.synthesis.SynthesizerModeDesc; import javax.speech.synthesis.Synthesizer; import com.sun.speech.freetts.jsapi.FreeTTSEngineCentral; import java.util.Locale;

public class HelloWorld { public static void main(String args[]) {

    try {
        // create SynthesizerModeDesc that will match the FreeTTS Synthesizer
        SynthesizerModeDesc modeDesc = new SynthesizerModeDesc(
                null, 
                "general", /* use "time" or "general" */
                Locale.US, 
                Boolean.FALSE,
                null);
        if(modeDesc == null)
            System.out.println("Error creating mode descriptor");

        FreeTTSEngineCentral central = new FreeTTSEngineCentral();
        Synthesizer synthesizer = null;

        EngineList list = central.createEngineList(modeDesc);
        if (list.size() > 0) { 
            EngineCreate creator = (EngineCreate) list.get(0); 
            synthesizer = (Synthesizer) creator.createEngine(); 
        }

        if (synthesizer == null) {
            System.err.println("Cannot create synthesizer");
            System.exit(1);
        }
        //get ready to speak
        synthesizer.allocate();
        synthesizer.resume();

        // say hello world
        synthesizer.speakPlainText("Hello, world!", null);
        // wait until speaking is done and clean up
        synthesizer.waitEngineState(Synthesizer.QUEUE_EMPTY);
        synthesizer.deallocate();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

}
and its showing me the thing like "System property "mbrola.base" is undefined. Will not use MBROLA voices." so what shud i do? I am not able to Listen any thing... help me