Problème avec javax.speech
salut tout le monde, j'ai réussi enfin de télecharger le package javax.speech
j'ai voulu le téster, mais j'ai tjs une erreur au niveau de "synth.allocate()"
voici mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| import java.util.Locale;
import javax.speech.*;
import javax.speech.synthesis.*;
public class Bienvenue {
public static void main(String args[]) {
String texteASynthetiser;
texteASynthetiser= "Bonjour";
texteASynthetiser+="<EMP LEVEL=\"strong\">" + "mon nom est " + "</EMP>";
texteASynthetiser+="<EMP LEVEL=\"reduced\">" + "Ordinateur" + "</EMP>";
try {
Synthesizer synth = Central.createSynthesizer( new
SynthesizerModeDesc(Locale.FRENCH));
synth.allocate();
synth.speak(texteASynthetiser, null);
synth.speak("fin du message", null);
synth.deallocate() ;
}catch (Exception e) {
e.printStackTrace();
}
}
} |
et voici l'erreur:
java.lang.NullPointerException
at testcm.Bienvenue.main(Bienvenue.java:27)
Merci d'avance.