I’m writing an application that is supposed to list all audio input devices along with their available channels and an id to identify the recording device across reboots and host systems.
I found that arecord -l can list (some?) audio input devices, but there doesn’t seem to be a way to list the channel count, although you can use the -c flag to record a specific amount of channels.
I even tried to write a loop that attemps to record with an increasing amount of channels until it fails, but it always fails at 65, even if there is only 1 channel.
In addition to that, the ids are not unique and not safe to use across different host systems.
Any ideas how this can be achieved in Bash?
Ideally independant of what audio system the host is using (like ALSA, Pulseaudio, Pipewire, Jack, Wireplumber, …)?