To configure various audio programs it is common that you will need the device name or some other designation. But, if you have multiple audio devices, which is increasingly common (sound on mother board, sound card, USB mic, USB camera with mic, external DAC, etc), how do you get a list?
To list the ALSA audio hardware:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: C2 [Cambridge Audio DAC100 USB 2], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: HDMI [HDA Intel HDMI], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 3: PCH [HDA Intel PCH], device 0: ALC662 rev3 Analog [ALC662 rev3 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
In the above list, I am seeking to use the "Cambridge DAC" so would choose hw:1,0
. However, USB devices might not get the same device numbers each time they're plugged in or when the computer reboots. So, the "hw:X,Y" device shown above might change. To solve this consider using the device alias rather than the hardware listing.
To list the audio device aliases:
aplay -L
hw:CARD=C2,DEV=0
Cambridge Audio DAC100 USB 2, USB Audio
Direct hardware device without any conversions
plughw:CARD=C2,DEV=0
Cambridge Audio DAC100 USB 2, USB Audio
Hardware device with all software conversions
iec958:CARD=C2,DEV=0
Cambridge Audio DAC100 USB 2, USB Audio
IEC958 (S/PDIF) Digital Audio Output
In the above output list "IEC958" is a standard defining digital connections for consumer electronics based on S/PDIF. This can be the best choice to use for an external (high quality) device. So, I would use iec958:CARD=C2,DEV=0
.
To list pulse audio sources:
pactl list short sources
And to list pulse audio sinks:
pactl list short sinks
which shows the device name "alsa_output.usb-Cambridge_Audio_Cambridge_Audio_DAC100_USB_2_0000-00.analog-stereo".
I use this information in an audio application's configuration file. For example, in MPD I edit the mpd.conf
audio output section:
audio_output { type "alsa" name "My ALSA output" device "iec958:CARD=Intel,DEV=0" mixer_control "PCM" }