I would like to record sound from 2 mic via the python modul pyaudio. The problem is that pyaudio only get the systemdefault pcm. There I could only record sound from one mic. My alsa.conf looks like:
defaults.ctl.card 1 #need to be set 1 to set usb mic to default
defaults.pcm.card 1 #need to be set 1 to set usb mic to default
defaults.pcm.device 0
defaults.pcm.subdevice -1
The Output from arecord -l:
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
sysdefault:CARD=Device
USB PnP Sound Device, USB Audio
Default Audio Device
front:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
Front speakers
surround21:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
Direct sample mixing device
dsnoop:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
Direct sample snooping device
hw:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
Direct hardware device without any conversions
plughw:CARD=Device,DEV=0
USB PnP Sound Device, USB Audio
Hardware device with all software conversions
sysdefault:CARD=Device_1
USB PnP Sound Device, USB Audio
Default Audio Device
front:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
Front speakers
surround21:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
Direct sample mixing device
dsnoop:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
Direct sample snooping device
hw:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
Direct hardware device without any conversions
plughw:CARD=Device_1,DEV=0
USB PnP Sound Device, USB Audio
Hardware device with all software conversions
And a selected output from pyaudio.Pyaudio().get_device_info_by_index:
0
bcm2835 ALSA: - (hw:0,0)
1
bcm2835 ALSA: IEC958/HDMI (hw:0,1)
2
USB PnP Sound Device: Audio (hw:1,0)
3
USB PnP Sound Device: Audio (hw:2,0)
4
sysdefault
5
front
6
surround40
7
iec958
8
spdif
9
dmix
10
default
I think the problem is that pyaudio hw1,0 and hw2,0 take. With arecord i have to take:
UsbMic1:arecord -f cd -D plughw
UsbMic2:arecord -f cd -D plughw:1
I have no idea to solve this strange problem. I would thank you for every single answer!