I have this error when I execute the recognition for the second time (the first one works well):
SEVERE microphone Can't open microphone line with format PCM_SIGNED 16000.0 Hz, 16 bit, mono, 2 bytes/frame, big-endian not supported. in edu.cmu.sphinx.frontend.util.Microphone:open-microphone
If I stop the program and turn it to launching, the first time is executed well but when doing the second recognition returns to giving the mistake.
the code of the method:
public String iniciaEscucha() {
Recognizerrecognizer;Microphonemicrophone;ConfigurationManagercm;URLurl=this.getClass().getResource("configuracion.xml");try{cm=newConfigurationManager(url);try{recognizer=(Recognizer)cm.lookup("recognizer");microphone=(Microphone)cm.lookup("microphone");/* allocate the resource necessary for the recognizer */recognizer.allocate();/* the microphone will keep recording until the program exits */if(microphone.startRecording()){Resultresult=recognizer.recognize();if(result!=null){StringresultText=result.getBestResultNoFiller();recognizer.deallocate();microphone.stopRecording();microphone.clear();return("Heescuchado:"+transformar(resultText));}else{recognizer.deallocate();microphone.stopRecording();microphone.clear();return("Noteentiendo");}}else{recognizer.deallocate();return("Nopuedoinicializarelmicrofono");}}catch(InstantiationExceptionex){returnex.getMessage();}catch(PropertyExceptionex){returnex.getMsg();}}catch(IOExceptionex){returnex.getMessage();}catch(PropertyExceptionex){returnex.getMsg();}}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
publicStringiniciaEscucha(){Recognizerrecognizer;Microphonemicrophone;ConfigurationManagercm;URLurl=this.getClass().getResource("configuracion.xml");try{cm=newConfigurationManager(url);try{recognizer=(Recognizer)cm.lookup("recognizer");microphone=(Microphone)cm.lookup("microphone");/* allocate the resource necessary for the recognizer */recognizer.allocate();/* the microphone will keep recording until the program exits */if(microphone.startRecording()){Resultresult=recognizer.recognize();if(result!=null){StringresultText=result.getBestResultNoFiller();return("Heescuchado:"+transformar(resultText));}else{microphone.stopRecording();return("Noteentiendo");}}else{recognizer.deallocate();return("Nopuedoinicializarelmicrofono");}}catch(InstantiationExceptionex){returnex.getMessage();}catch(PropertyExceptionex){returnex.getMsg();}}catch(IOExceptionex){returnex.getMessage();}catch(PropertyExceptionex){returnex.getMsg();}}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hello,
I have this error when I execute the recognition for the second time (the first one works well):
SEVERE microphone Can't open microphone line with format PCM_SIGNED 16000.0 Hz, 16 bit, mono, 2 bytes/frame, big-endian not supported. in edu.cmu.sphinx.frontend.util.Microphone:open-microphone
If I stop the program and turn it to launching, the first time is executed well but when doing the second recognition returns to giving the mistake.
the code of the method:
public String iniciaEscucha() {
here the code modified:
Do not close microphone and deallocate recognizer between calls, close it only once.
I finish of doing it just now, and it continues giving the same mistake.
Some another idea???
Paste updated code