sphinx4
sphinx4 copied to clipboard
Unable to recognise the Live stream voice using sphinx4
I have created code based on this tutorial https://cmusphinx.github.io/wiki/tutorialsphinx4/
performing Speech to text from a .wav file using StreamSpeechRecognizer works fine but I am facing issue with LiveSpeechRecognizer , In debug the code goes till recognizer.startRecognition(true); and never moves further , I am runnning this on intellij and using mac os Catalina
I suspect mac os or intellij is not allowing the file to use microphone
Code :
Configuration configuration = new Configuration();
configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
configuration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
configuration.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.bin");
LiveSpeechRecognizer recognizer = new LiveSpeechRecognizer(configuration);
recognizer.startRecognition(true);
SpeechResult result ;
while ((result = recognizer.getResult()) != null) {
System.out.println("speech recognition started");
System.out.println(result.getHypothesis());
}
recognizer.stopRecognition();
I've been experiencing the same issue. Debugger never moves past recognizer.startRecognition();
However, when I place print statements in my code to confirm which statements have successfully executed, I've found that the recognizer.startRecognition() is successful, but the line where the program stops for me is while ((result = recognizer.getResult()) != null). The program does not move inside the while loop, nor does it pass it. It seems to be stuck on .getResult().
Came to the same conclusion - could be an issue with accessing my device's microphone? Question to the team: is there any way for developers to set/test this?
Same issue ... 6 months later. And yes some indication that the microphone is (not) working would be good.