-
Notifications
You must be signed in to change notification settings - Fork 995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alsa problems on RaspBerry Pi3 #45
Comments
Is the detection actually working? Sometimes you see errors/warnings like this but the detection is already working. Also, see the thread here #9, people are able to get rid of those errors/warnings. |
I have the same errors as above and it isnt working. Does a server socket need to be installed? |
@Kushcabbage it's most likely the audio configuration problem.
|
I followed the steps in the docs and both the record and playback works flawlessly. I was able to fix the server socket error but running |
There could be two possibilities:
|
This is the output for my usb soundcard from Pyaudio's system_info.py
So I suppose the mic/card just doesn't support 16000? |
Most likely. I guess we'll have to replace PyAudio with something else as ALSA is causing a lot of problems. In the meantime you could probably try to use some other microphones? |
Yeah I may actually have a PS3 camera lying around somewhere.. So is this the fault of my microphone or the usb soundcard? |
Did you use any external usb sound card? Raspberry Pi doesn't come with usb sound card. If you use PS3 camera then you should be fine since that things has usb sound card, and we've verified that it's working on our end. |
Yeah I'm using an external usb sound card with a microphone and speakers connected to the 3.5mm jacks. I suppose a usb mic is recommended? |
Yes, it will work better with USB microphones. |
I now have the playstation camera setup as default by using .asoundrc , but it still throws the Invalid sample rate error
|
Ok the error above originates from where the output stream is opened, I was able to fix this by specifying the device index number. If the device index option is set before the rate then To find pyaudio device indexes I made a py file with this inside:
|
@Kushcabbage thanks for letting us know. This is very wired, if we have already set up the .asoundrc file, PyAudio should have picked up the right device. Anyways I'll keep this in mind when people ask in the future. Closing this since problem has been solved. Thanks! |
Thank you so much @Kushcabbage and @chenguoguo ! |
It could be that the input audio was not good enough. You could play with the sensitivity or audio_gain in this file (assuming you are using the Python example): https://github.com/Kitt-AI/snowboy/blob/master/examples/Python/snowboydecoder.py Increasing the sensitivity will make the detection easy, but will also introduce false alarms, it's a value between 0 and 1. Increasing the audio_gain will boost the input audio amplitude, you could try a value between 1 and 10. |
|
@adimnno when you record the Alexa samples on Raspberry Pi, and then upload it to snowboy.kitt.ai for model training, could you make sure that those audio samples are in good shape? In particular, please cut off the surrounding audio around Alexa for each audio sample. Sometime microphones on Raspberry Pi has noise and the VAD does not work well on that. Most likely that will make your Alexa.pmdl model work on Rapsberry Pi (assuming you use the same microphone). |
I have modified a little of the snowboydecoder.py to let it detect the data from my recorded sample files rather than the data from the microphone. I am using the Alexa.pmdl generated from your website by my voice samples. By the way, Happy Mid-Autumn Festival! |
Yes the sample rate has to be 16000 for Snowboy to work. It's probably a ALSA configuration problem. Have you set up your .asoundrc file correct? Have you tried @Kushcabbage 's trick (see above) to specify the microphone that supports 16000 sample rate? And thanks for mentioning the Mid-Autumn Festival, I miss my moon cakes :-) |
My USB microphone has a default sample rate of 48000. I just changed your input_stream's parameters to 48000 which avoided the errors but never work with the recognition. I think I will either change to another mic or convert the input sound from 48000 to 16000 programmatically then. It seems that command arecord can convert input to assigned sample rate automatically as I used the same USB microphone to record my samples. |
I fixed the problem.
If it doesn't work follow the instruction at the link above.
amixer cset numid=3 1 1: 3.5 audio jack Initially, it is 0 (automatic) but it doesn't work for some reason. Hope it works! |
I can record and play (using rec/play provided by sox) just fine, but when I instantiate PyAudio() I always get the same error. sigh I'm still looking for answers and I'll post as soon as I find any.
|
In most cases Snowboy still works even with though warnings/errors. We also have an arecord demo, so if you can't make PyAudio work, please give it a try: https://github.com/Kitt-AI/snowboy/blob/master/examples/Python/demo_arecord.py |
I find the problem that some usb microphone does not support rate 16000, 1 channel. If there comes some converting code, will be great! |
I'm using Raspberry Pi3 with raspbian for implementation.
When running the python demo, comes the error messages as follow:
I have followed the instructions on https://snowboy.kitt.ai/docs to modify the .asoundrc file. I am not able to figure out the problems here. Is it something about alsa configuration or the port audio settings?
The text was updated successfully, but these errors were encountered: