speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

listen_in_background is not calling the callback at all

Open ObadaZay opened this issue 1 year ago • 1 comments

I was trying the background_listening.py example, but it doesn't give any output, it doesn't even call the callback function, I've tried Python 3.11, Python 3.8 and python 3.9 and tried different microphones with making sure I have the correct index inside m = sr.Microphone() but doesn't seem to work and I don't get any error, and the normal microphone example works fine but because i need to stop it on request without a specific duration I need to use background listening

Edit: Sometimes it works, most of times it doesn't, can't know what happens although no change in code or libraries

Steps to reproduce

  1. pip install speechRecognition==3.10.0 and pip install PyAudio==0.2.13
  2. Run the background_listening.py example

Expected behaviour

It should give normal output (the spoken words, error (Google Speech Recognition could not understand audio, Could not request results from Google Speech Recognition service)).

Actual behaviour

No output at all, after tracing the callback is not being called at all.

System information

My system is <Windows 11>.

My Python version is <3.8, 3.9, 3.11>.

My Pip version is <22.3.1, 23.1.2>.

My SpeechRecognition library version is <3.10.0>.

My PyAudio library version is <0.2.13>

My microphones are: [ "Microsoft Sound Mapper - Input", "Microphone (Realtek(R) Audio)", "Microsoft Sound Mapper - Output", "Speakers (Realtek(R) Audio)", "Primary Sound Capture Driver", "Microphone (Realtek(R) Audio)", "Primary Sound Driver", "Speakers (Realtek(R) Audio)", "Speakers (Realtek(R) Audio)", "Microphone (Realtek(R) Audio)", ]

My working microphones are: {0: 'Microsoft Sound Mapper - Input', 1: 'Microphone (Realtek(R) Audio)', 4: 'Primary Sound Capture Driver', 5: 'Microphone (Realtek(R) Audio)', 9: 'Microphone (Realtek(R) Audio)'}

ObadaZay avatar Jun 01 '23 17:06 ObadaZay

I have the same issue, the background_listening.py example doesn't seem to work at all.

alexiri avatar Sep 02 '23 17:09 alexiri