IOError: [Errno Input overflowed] -9981
I tried to run the code, but got an error (Mac OSX 10.8.3, portaudio-19.20111121). This is a known problem? There is the solution?
- listening. CTRL+C to finish.
Traceback (most recent call last):
File "stt_google.py", line 102, in
listen_for_speech() File "stt_google.py", line 44, in listen_for_speech data = stream.read(512) File "/Users/......./lib/python2.7/site-packages/pyaudio.py", line 605, in read return pa.read_stream(self._stream, num_frames) IOError: [Errno Input overflowed] -9981
got the same issue :(
I've experienced the same issue. This is a bug which is very much hardware specific, based upon the mic you're using.
There are a number of troubleshooting steps you can take.
- Try changing the sampling rate, RATE. Most mics work better with 44100 from experience, this requires changing this RATE variable and modifying the google web speech API call to change sampling rate given.
- Change the CHUNK size. I managed to get rid of the problem by using CHUNK size 4096 rather than 512. With this it may also be necessary to add the following around the stream.read(chunk)
try: stream.read(chunk) except IOError, e: if e.args[1] == pyaudio.paInputOverflowed: data = '\x00'*chunk else: raise
Please feel free to check out my forked solution in the publicly available Barista-Bot repo at, https://github.com/Barista-Bot/voice-control/blob/master/scripts/flacrecord.py
--- I'll fork the repo and knock out a quick fix later, i've found a few improvements and extra features which should make peoples lives easier and I'll try and pull request it back. Don't know if dev is active