this is an example of java speech synthesizer.. which is givin runtime err

hi..

this code i have taken from one of the site.. but its not workin.. this code also throwing the java.lang.nullpointer exception... i have load the speech api properly..

please help me..

import javax.speech.synthesis.*;

import java.util.Locale;

public class HelloWorld {

public static void main(String args[]) {

try {

// Create a synthesizer for English

Synthesizer synth = Central.createSynthesizer(

new SynthesizerModeDesc(Locale.ENGLISH));

// Get it ready to speak

synth.allocate();

synth.resume();

// Speak the "Hello world" string

synth.speakPlainText("Hello, world!", null);

// Wait till speaking is done

synth.waitEngineState(Synthesizer.QUEUE_EMPTY);

// Clean up

synth.deallocate();

} catch (Exception e) {

e.printStackTrace();

}

}

}

[896 byte] By [vishaliyera] at [2007-10-3 2:43:49]
# 1
I don`t know which implementation you are using but generally you have tosynth.waitEngineState(Synthesizer.ALLOCATED);after a call to synth.allocate(); synth.resume();regards
messengersa at 2007-7-14 20:32:12 > top of Java-index,Security,Cryptography...
# 2

thanks for your reply..

i add tht line on tht code too.. but its still throwin runtime exception jaba.lang.NullPointer exception...

synth.allocate();

it might be because of the Synthesizer object cannot be initialized properly..

Synthesizer synth = Central.createSynthesizer(

new SynthesizerModeDesc(Locale.getDefault()));

pls help me in this topic..

vishaliyera at 2007-7-14 20:32:12 > top of Java-index,Security,Cryptography...
# 3
Which implemenation of the jsapi are you using?regards
messengersa at 2007-7-14 20:32:12 > top of Java-index,Security,Cryptography...
# 4
hi there i am facing same error, null pointer exception, i was wandering if you manage to solve this issue. if so please let me know how did u manage to solve this error i have spent almost a week now but i am not able to fix it. i am looking forward to hear from you soon
Fattaka at 2007-7-14 20:32:12 > top of Java-index,Security,Cryptography...
# 5

hello

i am also working on such project , and facing same problem .

as well as i think synthesizer is not initialized , when u call createSynthesizer() .

there is another case where u search for the existing engines and create one of the selected Engine from the list.

"JAVA 2 Unleashed " has dedicated chapter for speech api working and FAQs.

if U got any concerned material then let me know

thanks

dheeraj_chda at 2007-7-14 20:32:12 > top of Java-index,Security,Cryptography...