Kitt-AI / snowboy

Future versions with model training module will be maintained through a forked version here: https://github.com/seasalt-ai/snowboy
Other
3.11k stars 1.01k forks source link

Why I cannot use function for input voice from callback #439

Open ploveaiit opened 6 years ago

ploveaiit commented 6 years ago

run snowboy and detected hotword then call my function

and then I got this error "IOError: [Errno -9985] Device unavailable"

code in my callback function import speech_recognition as sr r = sr.Recognizer() with sr.Microphone() as source: audio = r.listen(source)

thank you for your help

chenguoguo commented 6 years ago

The error says your function was not able to get the microphone. Most likely the microphone is occupied by one thread (e.g., snowboy) and you are trying to use it in another (e.g., your recognizer)

ploveaiit commented 6 years ago

What should I do to fix this problem ?

Sanjit1 commented 6 years ago

Are you using Raspbian?

ploveaiit commented 6 years ago

Yes I am using Raspbian Debian 9

Sanjit1 commented 6 years ago

Go to start. In preferences select audio device. Then select sound card. Select all the options one by one. If you find Microphone and auto gain control in one of them, then that is your microphone. Select both the options. In the capture tab, set your microphone volume to full, and In switches, enable auto gain control.

ploveaiit commented 6 years ago

I do all but still got same error @Sanjit1

Sanjit1 commented 6 years ago

Have you installed all the dependencies? Install these : SoX: sudo apt-get install sox libsox-fmt-all PortAudio: sudo apt-get install python-gnuradio-audio-portaudio SWIG 3.0.10: git clone https://github.com/swig/swig.git && cd swig && ./autogen.sh && ./configure && make && sudo make install

OpenBLAS: sudo apt-get install git python-dev gfortran && cd ~/src && git clone https://github.com/xianyi/OpenBLAS && cd OpenBLAS && make FC=gfortran && sudo make PREFIX=/opt/openblas install

ploveaiit commented 6 years ago

I can install SoX, SWIG and OpenBLAS but I cannot install python-gnuradio-audio-portaudio sudo apt-get install python-gnuradio-audio-portaudio Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package python-gnuradio-audio-portaudio

Sanjit1 commented 6 years ago

Try sudo apt-get install libasound-dev ./configure && make sudo make install

hopeswiller commented 3 years ago

I get this error

E: Unable to locate package python-gnuradio-audio-portaudio 

when i ran sudo apt-get install python-gnuradio-audio-portaudio