I'm trying to get python audio input on my raspberry pi. So far I've installed the following:
My inquiry looks similar to this one, but I'm not using an audio card, I just have a webcam plugged directly into my usb drive. I was able to get a recording via:
arecord -D plughw:1,0 -f cd -d 10 test.wav
and then play it back no problem. Next I wanted to get the audio into python.
I've tried PyAudio via the first two lines of the example on the PyAudio documentation:
import pyaudio
pyaudio.PyAudio()
which returns
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.BRCM bcm2835 AL.pcm.front.0:CARD=0'
and a bunch more ASLA errors. I've also tried a snippet using alsaaudio:
import alsaaudio
inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE,alsaaudio.PCM_NONBLOCK)
which returns:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
alsaaudio.ALSAAudioError: No such file or directory
Do I need to do something special to configure my ALSA installation to detect my webcam? I'm thinking about trying to use PyUSB to connect directly to the webcam, but that seems too low level to be fun. Does anyone know how to get PyAudio working through the above error? Is there a different package that I might try?