4

I'm attempting to record sound on the Pi. I am using PyAudio for this and everytime I do even the following:

import pyaudio 
pa = pyaudio.PyAudio()

I get the following errors:

ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pc.default
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51  
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only  
playback stream
ALSA lib pcm_direct.c:877:(snd1_pcm_direct_initialize_slave) slave plugin does 
not support mmap interleaved or mmap noninterleaved access
ALSA lib pcm_dmix.c:1030:(snd_pcm_dmix_open) unable to initialize slave
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

Please could someone tell me why am I getting these errors and how do I go about fixing them? It doesn't happen on my laptop nor on my desktop which does not have a Microphone.

Any ideas would be greatly appreciated. Thanks

  • Have you solved your problem? If so, please mark the answer that helped you, or if you solved it on your own, create a self-answer and mark it as such. We are trying to get the site Q:A ratio up and marking answers is what does that. If you resolved it and mark then people in the future will be able to profit from what you did and it helps move the site closer to graduation. Thanks! – RPiAwesomeness Mar 23 '14 at 17:00
1

You're supposed to set the default sound card in order to make PyAudio module work,

Setting a default Sound card,

edit alsa-base.conf file,

ed /etc/modprobe.d/alsa-base.conf

and set,

options snd-card-usb-caiaq index=0

you can get the list of all available sound cards in your Pi using,

arecord --list-devices

or

arecord -L
1

These are not errors, but warnings. You can ignore these warnings while initializing PyAudio.

They appear because they're set up in your Raspberry Pi configuration file for audio drivers for the HDMI audio (which has surround sound).

If you use a different audio card as the default, like a USB microphone or webcam, you will get these warnings that PyAudio could not find these.

You can comment out initialization lines for unused audio channels in the config file:

sudo nano /etc/modprobe.d/alsa-base.conf

And this will hide the warnings.

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – syb0rg Oct 7 '13 at 4:17
  • 2
    @syb0rg Sometimes an answer isn't exactly what the asker is looking for. You can propose an edit, downvote this answer, and/or answer the question yourself if you don't think it's good enough. – ramblinjan Oct 8 '13 at 23:25
  • @jandjorgenson That comment was in respect to the original answer. Since then, the answer has been edited. – syb0rg Oct 9 '13 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.