pythonraspberry-pipyaudioportaudiolibasound

PyAudio throws warnings on Raspberry Pi


Since I found no answer for my question, neither in older posts nor in other forums, I want to ask the stackoverflow community for advice.

I am using a raspberry pi, version 9 (stretch) with kernel version 4.14.71-v7. It should be the newest image available.

I wanted to use pyaudio for playback and record audiostreams. On my windows home pc everything works fine without any trouble. But even creating an pyaudio object on the raspberry pi throws some strange warnings.

First I installed the following stuff to use pyaudio:

    sudo apt-get install libasound-dev

raspberry pi automatically selected libasound2-dev

    sudo apt-get install portaudio19-dev
    sudo apt-get install python3-pyaudio

If I run the following python code:

   import pyaudio
   py=pyaudio.PyAudio()

I get these warning:

   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.front.0:CARD=0'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM front
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround40.0:CARD=0'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround71.0:CARD=0'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2                    =0,AES3=2'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2                    =0,AES3=2'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2                    =0,AES3=2'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
   '$'ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
   '$'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
   '$'ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or directory
   '$'ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
   '$'connect(2) call to /tmp/jack-1000/default/jack_0 failed (err=No such file or directory)
   '$'attempt to connect to server failed

For me it looks like pyaudio wants to use the hdmi (with surround sound), the jack, and the bluetooth (bluealsa). It seems that pyaudio does not use portaudio. But I do not know it for sure.

Maybe someone knows, why just creating an object throws these warnings. Next to these warning the pyaudio library seems to work. I can playback and record audiostream, but these warnings appear every time.


Solution

  • Thanks to the stackoverflow community. I got an link to an older topic, that gives the perfect solution.

    The reason why all these warnings occur and how to handle them with python are explained.

    Great thanks!!!