$ cat /proc/asound/cards
Shows your "known" cards. Meaning they have drivers, even if input or output (microphones) options don't exist.
$ find /proc/asound/ -iname '*pcm*p*'
The ending "p" is for playback, aka output. One way to more easily identify card # and device #.
$ find /proc/asound/ -iname '*pcm*c*'
The ending "c" is for capture, aka input.
You can also egrep the contents of /proc/asound/ (associated with alsa and it's drivers).
$ egrep -r -i "hdmi" /proc/asound/*
On my system additional details can be seen about my HDMI.
$ less /proc/asound/card0/pcm3p/info
Code:
card: 0
device: 3
subdevice: 0
stream: PLAYBACK
id: HDMI 0
name: HDMI 0
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
The take away from this information is that hw:0,3,0 is the alsa long name for my HDMI audio.
$ speaker-test -c 2 -l 1 -D hw:0,3,0
Where the numbers are card #, device #, subdevice #. The subdevice number is optional most times, not so much when using snd-aloop, a fake card who's input (capture) is it's output (playback). For devices with a 0 value, even that one is optional. But that's just alsa, not pulse which is a different animal.
For my laptops speaker output:
$ less /proc/asound/card1/pcm0p/info
Code:
card: 1
device: 0
subdevice: 0
stream: PLAYBACK
id: ALC3227 Analog
name: ALC3227 Analog
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
$ speaker-test -c 2 -l 1 -D hw:1
Since defaults are 0, I can omit the device and subdevice. For pulseaudio it "should" show up as a selection. But that's not always the case. I had to add extra stuff for my Delta 44 about a decade ago. But that's no longer needed for the past five years or so.