Skip to content
systemcoding.dev
Media

List ALSA devices with aplay -l

List the playback cards and devices ALSA sees with aplay -l from alsa-utils 1.2, and turn the output into a hw:card,device name.

1 min read
Summarize in AI

aplay -l prints every playback hardware device ALSA knows about, and the numbers in its output are what you put into a device string such as hw:0,0. The command comes from alsa-utils 1.2.

Shell
aplay -l
Text
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC3246 Analog [ALC3246 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Your cards will differ. Read it as card N ... device M: the analog output above is hw:0,0, the HDMI output is hw:0,3, and the USB device is hw:1,0. The text in square brackets is the card id, and hw:PCH,0 works as well and survives a change in boot order, which numbers do not.

hw: opens the hardware directly with no format conversion, so it fails if you ask for a rate or sample format the chip does not support. plughw:0,0 puts ALSA's plug layer in front and converts for you. aplay -L is the other listing: it prints every PCM name, including default, sysdefault and any dmix entries, and is the list a program should offer to its users. Use arecord -l for capture devices.

Taggedlinuxalsa
Share

More snippets

Media

Create an instance with libvlc_new

Create a libVLC 3.0 engine instance with libvlc_new, check for NULL when plugins are missing, and print the version it loaded.

1 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.