Want to make Text to speech example ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Atul Goyal
    New Member
    • Aug 2010
    • 12

    Want to make Text to speech example ?

    I am using following example but it give me null pointer exception. It is not created the object of synthesis .


    import javax.speech.*;
    import javax.speech.sy nthesis.*;
    import java.util.Local e;

    public class HelloWorld {
    public static void main(String args[]) {
    try {
    // Create a synthesizer for English
    Synthesizer synth = Central.createS ynthesizer(
    new SynthesizerMode Desc(Locale.ENG LISH));

    // Get it ready to speak
    synth.allocate( );
    synth.resume();

    // Speak the "Hello world" string
    synth.speakPlai nText("Hello, world!", null);

    // Wait till speaking is done
    synth.waitEngin eState(Synthesi zer.QUEUE_EMPTY );

    // Clean up
    synth.deallocat e();
    } catch (Exception e) {
    e.printStackTra ce();
    }
    }
    }

    Can u help me to solve this ?
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    Please do not double post.

    Regards
    Dheeraj Joshi

    Comment

    Working...