I am trying to make a simple studio recording application. I have multiple sound input devices, and would like to record them all simultaneously.
How do I discover all physical audio inputs?
When I use sounddevice.query_devices()
, I get a lot of virtual devices and a lot of virtual input channels, that contain no data:
>>> sd.query_devices()
0 HDA Intel PCH: HDMI 0 (hw:0,3), ALSA (0 in, 8 out)
1 HDA Intel PCH: HDMI 1 (hw:0,7), ALSA (0 in, 8 out)
2 HDA Intel PCH: HDMI 2 (hw:0,8), ALSA (0 in, 8 out)
3 hdmi, ALSA (0 in, 8 out)
4 pulse, ALSA (32 in, 32 out)
* 5 default, ALSA (32 in, 32 out)
6 /dev/dsp, OSS (16 in, 16 out)
I am only interested in real devices, and real input channels.
When I query microphone devices with pacmd
and then list-sources
I get two channels giving fake stereo, even though the device is mono:
$ pacmd
>>> list-sources
...
channel map: front-left,front-right
Stereo
Is there a way to either query PulseAudio, or PortAudio to get physical input channels? And their parameters (so that I can pick sample rate etc.)
(hw:X,Y)
in the device name, but I'm not sure if that matches exactly the devices you would like to see. – Matthias