Skip to content
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

Once again, Audio issue #9

Closed
sciencegirl100 opened this issue May 24, 2016 · 14 comments
Closed

Once again, Audio issue #9

sciencegirl100 opened this issue May 24, 2016 · 14 comments

Comments

@sciencegirl100
Copy link

so, if I try to use a pmdl, I get This error. I tried running python with sudo and as a normal user.

@chenguoguo
Copy link
Collaborator

@flooie may have good insights. @flooie could you help us here?

It looks like a driver problem or setup problem to me. Also, when I played with Raspberry Pi I also had to add my user (if you are not using the root user) to the audio group to make PyAudio work.

What is the output of "arecord -l" on your Pi? And what is your ~/.asound file?

@flooie
Copy link

flooie commented May 24, 2016

Geez. Idk.

I can tell you that

$ ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
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

I get all or most of the same warnings that I read somewhere are irrelevant - I was able to get some of them off.

@flooie
Copy link

flooie commented May 24, 2016

@chenguoguo @sciencedude100 is this for the alexa pi?

@chenguoguo
Copy link
Collaborator

@flooie, this is for Amazon's version I think. @sciencedude100 mentioned it here: #8

BTW @sciencedude100, @flooie has made it work for AlexaPi https://github.com/sammachin/AlexaPi/pull/85

@xuchen
Copy link
Collaborator

xuchen commented May 24, 2016

It looks like an audio playback problem, @sciencedude100 what's your aplay -l output? It could be that you have audio playback on the HDMI port.

The error came from trying to play the "ding" sound on triggered sound. Alternatively, I saw you defined detected_callback, so if you pass stream_callback=detected_callback, you should get a printed alert instead of audio alert. But it will work.

@sciencegirl100
Copy link
Author

Ok, turns out my mic wasn't plugged in all the way... DERP!
Now I have a whole new error to deal with here
I get the same error when trying my pmdl (which I have calibrated to my mic and the keyword "Hal")
Here's my ~/.asoundrc file
I have a working python script that initiates Alexa's listening, I just want snowboy to run it when it hears "Hal" (Yeah, I'm making a functional HAL 9000 Computer, but not from Urbana, Illinois)

@chenguoguo
Copy link
Collaborator

chenguoguo commented May 24, 2016

I actually saw this post on stack overflow, and I was like: oh, no way that dude was working without a mic... :-)
http://stackoverflow.com/questions/33382305/pyaudio-ioerror-errno-invalid-input-device-no-default-output-device-9996

One comment, please use snowboy.umdl under the devel branch. The snowboy.umdl model under the master was problematic and we haven't merged the fix. Regarding the personal model, since your model Hal is pretty short, make sure you play with different sensitivity values.

Now Let's try to look into the issue. So at this point you can record the audio by typing "rec -r 16000 t.wav" (yes, with the sampling rate 16000) and then play it back by "play t.wav" right? My feeling is that your ALSA is somehow messed up. One thing to try is to explicitly tell PyAudio which device to use. You can follow this post here:
https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=97702
and take a look at the post by "afreitas"

You will have to modify the snowboydecoder.py file at line 108-115, and change them to something like follows:

    self.stream_in = self.audio.open(
        input=True, output=False,
        format=pyaudio.paInt16,
        channels=1,
        rate=16000,
        frames_per_buffer=2048,
        stream_callback=audio_callback,
        input_device_index=INPUT_DEVICE_INDEX)

where you can choose your INPUT_DEVICE_INDEX by following the post.

Please also take a look at this post. jasperproject/jasper-client#226

Hope this will solve the issue.

@sciencegirl100
Copy link
Author

found a python script to find the IDs Here with a result of this
Here is my snowboydecoder.py (i fixed the semicolon on line 110)
Well, Here is the current result, still -9997

@sciencegirl100
Copy link
Author

I think it might be my alsa config, I even tried to reset it with sudo alsactl restore -P

@chenguoguo
Copy link
Collaborator

@sciencedude100 It might be disappointing, but mostly likely the problem can be solved by starting from a fresh Raspbian installation... See the post here. Please let us know if that helps.

@sciencegirl100
Copy link
Author

sciencegirl100 commented May 28, 2016

I'll set up snowboy before Alexa

P.S. My project is now on hold to focus on This

@illperipherals
Copy link

I was able to resolve the following errors below:

$ ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

from /usr/share/alsa/alsa.conf, remove:

pcm.rear cards.pcm.rear
pcm.center_lfe cards.pcm.center_lfe
pcm.side cards.pcm.side
pcm.hdmi cards.pcm.hdmi
pcm.modem cards.pcm.modem
pcm.phoneline cards.pcm.phoneline
X11 proxy: Unsupported authorisation protocol
xcb_connection_has_error() returned true

copy the .Xauthority file from my own profile /home directory to /root.

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

/usr/share/alsa/alsa.conf.d/ remove pulseaudio files. Check home directory for .asoundrc and remove pulseaudio from there if needed.

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
jack_control start

After making those changes, I no longer get the errors, just:

Listening... Press Ctrl+C to exit

@chenguoguo
Copy link
Collaborator

@illperipherals awesome, thanks for letting us know! I'll do some testing and possibly add those suggestions to the documentation in the next release.

@hack-r
Copy link

hack-r commented Mar 4, 2018

@illperipherals jack_control start was incredibly helpful after hours of working with Jack to to avail.

I will mention for future readers that this has to be run with Python 2 (so probably outside of your virtualenv).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants