speech_recognition: IOError: [Errno Input overflowed] -9981
I got this error after the recognition worked OK once.
Source code:
import speech_recognition as sr
r = sr.Recognizer()
m = sr.Microphone()
m.RATE = 44100
m.CHUNK = 512
print("A moment of silence, please...")
with m as source:
r.adjust_for_ambient_noise(source)
print("Set minimum energy threshold to {}".format(r.energy_threshold))
while True:
print("Say something!")
audio = r.listen(source)
print("Got it! Now to recognize it...")
try:
print("You said " + r.recognize(audio))
except LookupError:
print("Oops! Didn't catch that")
Error message:
A moment of silence, please...
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
Set minimum energy threshold to 350.037988116
Say something!
Got it! Now to recognize it...
You said hello testing testing
Say something!
Traceback (most recent call last):
File "listen.py", line 14, in <module>
audio = r.listen(source)
File "/usr/local/lib/python2.7/dist-packages/speech_recognition/__init__.py", line 265, in listen
buffer = source.stream.read(source.CHUNK)
File "/usr/lib/pymodules/python2.7/pyaudio.py", line 564, in read
return pa.read_stream(self._stream, num_frames)
IOError: [Errno Input overflowed] -9981
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 20 (9 by maintainers)
This seems to be caused by the script not being able to keep up with the audio input.
Try increasing the chunk size to boost the recognition speed: