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 ?
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 ?
Comment