java - Exception in thread "AWT-EventQueue-0" javax.speech.EngineStateError: Invalid EngineState -


hi i'm using voce library (uses freetts , sphinx4) in application need both speech synthesis , speech recognition.

here speech recognition code

public class recognitiontest{ public static void main(string argv){          voce.speechinterface.init("c:/users/netbeansprojects/src", false, true,          "file:/c:/users/src/grammar", "words");          system.out.println("this speech recognition test. " );          try{         string s="";         s = voce.speechinterface.poprecognizedstring();         system.out.println("you said: " + s);          if(s.equalsignorecase("log in")){                        startapplication.count=1;           }           else if(s.equalsignorecase("sign up")){                         startapplication.count=2;             }              else{                         //do nothing               }         voce.speechinterface.destroy();       }        catch (exception e)         {            system.out.println(e);         }     }    } 

i call java application called startapplication , in continuously check whether value of count has changed 0 or 1 , if not main method called agian.

however when login recognized , value of count changed 1 following exception generated

exception in thread "awt-eventqueue-0" javax.speech.enginestateerror: invalid enginestate: expected=( deallocated  deallocating_resources ) current state=( deallocated  queue_empty ) @ com.sun.speech.engine.baseengine.checkenginestate(baseengine.java:705) @ com.sun.speech.freetts.jsapi.freettssynthesizer.cancelall(freettssynthesizer.java:238) @ voce.speechsynthesizer.destroy(speechsynthesizer.java:110) @ voce.speechinterface.destroy(speechinterface.java:97) @ mailforblind.recognitiontest.main(recognitiontest.java:27) @ mailforblind.startapplication.mouseclicked(startapplication.java:174) @ java.awt.component.processmouseevent(component.java:6538) @ javax.swing.jcomponent.processmouseevent(jcomponent.java:3324) @ java.awt.component.processevent(component.java:6300) @ java.awt.container.processevent(container.java:2236) @ java.awt.component.dispatcheventimpl(component.java:4891) @ java.awt.container.dispatcheventimpl(container.java:2294) @ java.awt.component.dispatchevent(component.java:4713) @ java.awt.lightweightdispatcher.retargetmouseevent(container.java:4888) @ java.awt.lightweightdispatcher.processmouseevent(container.java:4534) @ java.awt.lightweightdispatcher.dispatchevent(container.java:4466) @ java.awt.container.dispatcheventimpl(container.java:2280) @ java.awt.window.dispatcheventimpl(window.java:2750) @ java.awt.component.dispatchevent(component.java:4713) @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:758) @ java.awt.eventqueue.access$500(eventqueue.java:97) @ java.awt.eventqueue$3.run(eventqueue.java:709) @ java.awt.eventqueue$3.run(eventqueue.java:703) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:76) @ java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:86) @ java.awt.eventqueue$4.run(eventqueue.java:731) @ java.awt.eventqueue$4.run(eventqueue.java:729) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:76) @ java.awt.eventqueue.dispatchevent(eventqueue.java:728) @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:201) @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:116) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:105) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:101) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:93) @ java.awt.eventdispatchthread.run(eventdispatchthread.java:82) 

following startapplication code snippet,

 public void mouseclicked(mouseevent e) {   try{   while(count==0)   recognitiontest.main("");    if(count==1){       loginpage.main();   }   if(count==2){       signuppage.main();   }   }catch(exception ee){system.out.println(ee);} } 

inorder avoid removed voce.speechinterface.destroy(); when call other application throws following exception

'severe microphone can't open microphone line format pcm_signed 16000.0hz, 16 bit, mono, 2 bytes/frame, big-endian not supported.  in edu.cmu.sphinx.frontend.util.microphone:open-microphone  cannot start microphone.' 

how fix this?

with cmu sphinx (available in voce) 1 can't use speech interface @ same time both reading , writing. once interface opened reading should destroyed able open again writing or vice versa. hence error,

invalid enginestate: expected=( deallocated  deallocating_resources ) current state=( deallocated  queue_empty ) 

and

cannot start microphone 

Comments