speech_recognition
speech_recognition copied to clipboard
recognizer.listen(source) is not stopping automatically even with "with" statement
Steps to reproduce
- (How do you make the issue happen? Does it happen every time you try it?)
- (Make sure to go into as much detail as needed to reproduce the issue. Posting your code here can help us resolve the problem much faster!)
- (If there are any files, like audio recordings, don't forget to include them.)
Expected behaviour
it should print both listening... and processing...
(What did you expect to happen?)
Actual behaviour
(What happened instead? How is it different from what you expected?)
(If the library threw an exception, paste the full stack trace here)
System information
(Delete all the statements that don't apply.)
My system is Ubuntu 20.04.1 LTS
My Python version is python 3.8.2. (You can check this by running python -V
.)
My Pip version is pip 20.0.2. (You can check this by running pip -V
.)
My SpeechRecognition library version is 3.8.1. (You can check this by running python -c "import speech_recognition as sr;print(sr.__version__)"
.)
My PyAudio library version is 0.2.11. (You can check this by running python -c "import pyaudio as p;print(p.__version__)"
.)
My microphones are: [ 'HDA ATI HDMI: 0 (hw:0,3)', 'hdmi', 'jack', 'pulse', 'default']
(You can check this by running python -c "import speech_recognition as sr;print(sr.Microphone.list_microphone_names())"
.)
My working microphones are: given cmd is not working(You can check this by running python -c "import speech_recognition as sr;print(sr.Microphone.list_working_microphones())"
.)
I installed PocketSphinx from <INSERT SOURCE HERE>. (For example, from the Debian repositories, from Homebrew, or from the source code.)
I am a user, i was having a very similar issue on mac i found that the problem was that my code did not have the necessary permissions to access the microphone. I hope this might help you to understand better your problem. ~RP
The problem here is you are not calling a recognizer, please see the microphone examples for an example.
As an example, if you wanted to use sphinx:
r.recognize_sphinx(audio)
would be what you would call to get recognition.