I'm trying to drive a RGB LED strip with RPI's GPIO18 in python with rpi_ws281x library while listening to USB Microphone connected to the RPI to finally send colors depending on audio frequencies captured.
Problem: the LED strip works fine UNTIL i instanciate the pyAudio Object. As soon as I execute the following instructions:
>>> import pyaudio
>>> p = pyaudio.PyAudio() # <-- after this instruction the LED strip is KO
After that instruction the LED strip blocks or displays random colors. PyAudio outputs some messages see at the end of this post.
Is there an incompatiblity between GPIO18 in PWM mode and PyAudio ?
Any help would be appreciated, and Merry Christmas All!
Notes:
- I use the strandtest.py script to test the led strip (see reference below). This script works great.
- Recording microphone manually with arecord command while LED strip is being driven by strandtest.py works great too
- PyAudio input mode works. I managed to get audio frequencies with fft.
References:
(NeoPixel sample wiring)[https://learn.adafruit.com/neopixels-on-raspberry-pi/wiring]
(rpi_ws281x strandtest)[https://github.com/jgarff/rpi_ws281x/blob/master/python/examples/strandtest.py]
PyAudio's messages:
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.front.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM front
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 confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm28 35.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned err or: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directo ry
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif
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