rcbyron / hey-athena-client

Your personal voice assistant
https://heyathena.com
MIT License
420 stars 98 forks source link

Input Overflowed -9981 #43

Open Thasmokey opened 8 years ago

Thasmokey commented 8 years ago

The last 2 days i have been in a lot of issues with Athena. Know i have decided to use Athena on my Raspberry Pi 2. After installing i put the command from athena import __main__ Now i get this error message:

~ Hey there, ThaSmokey!

~ Try asking:

~ Waiting to be woken up... Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/athena/brain.py", line 224, in run stt.listen_keyword() File "/usr/local/lib/python3.4/dist-packages/athena/stt.py", line 45, in listen_keyword buf = stream.read(256) File "/usr/lib/python3/dist-packages/pyaudio.py", line 605, in read return pa.read_stream(self._stream, num_frames) OSError: [Errno Input overflowed] -9981

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.4/dist-packages/athena/main.py", line 4, in brain.inst.run() File "/usr/local/lib/python3.4/dist-packages/athena/brain.py", line 240, in run raise Exception Exception

I have searched they hole internet, also changed de sample rate and the (CHUNK) buf = stream.read(256) from 2/4/8/16/32/64/128/256/512 to 8192

I have used a microphone and a build-in microphone from a webcam.

rcbyron commented 8 years ago

Hi again, sorry you're having more issues. I hope you got everything fixed on your main computer/system. As for the RPi 2, one of the developers in our community posted these comments:

AVBin is not available for the Raspberry's ARM arquitecture. Workaround: I used os.system("mplayer -really-quiet " + file). Better idea, use pygame or some lightweight multiplatform library to play compressed audio Without Internet connection, a fallback to use PicoTTS (libttspico-utils: /usr/bin/pico2wave) would be nice. I used it, again, with os.system("read.sh " + words) and a little bash script that makes the wave file using pico2wave, plays it and removes it. Would be better to try to use the libpicotts directly from Python.

And with respect to this issue:

The RPI2 doesn't have an audio input. I used a very cheap USB "soundcard" that has both output and mic. I run into a problem with a (possibly buggy) with pyaudio. The error was: IOError: [Errno Input overflowed] -9981 I solver it by modifying the "buf = stream.read(1024)" line in stt.py and adding a parameter to ignore overflows ( I don't remember exactly, was something like except_on_overflow=False ). I can tell you later when at home.

This seems to be a popular issue: http://stackoverflow.com/questions/10733903/pyaudio-input-overflowed

I'll be looking into this issue more, but maybe this will help in the meantime.

joshgel commented 8 years ago

I was able to suppress this error by modifying the "buf = stream.read(1024)" line in stt.py to "buf = stream.read(1024, exception_on_overflow=False)"

(still getting lots of errors though)

ivaniclixx commented 8 years ago

Hi joshgel,

Try using pulseaudio with the Raspberry Pi 2. It kinda makes it work better.

pulseaudio -D

Then, you can use:

pactl list short

Copy the desired input device, and: pactl set-default-source [device name]

For example:

pactl set-default-source alsa_input.usb-0d8c_USB_PnP_Sound_Device-00-Device.analog-mon

I am very busy lately, but i'll try to contact the developers and update the documentation on how to make everything work properly under the raspbian. Hope it helps.