figuring out which monitors and which audio devices correspond

From: Jonathan Gilbert
Date: Mon May 19 2025 - 19:00:28 EST


Hello :-)

When an HDMI cable is connected from my computer to a device that handles both video and audio, the system automatically sets up multiple logical devices for it. One of them represents the monitor for the purposes of display. I can list monitors with a tool like xrandr. The other one is an audio sink (correct term?) for delivering sound down that HDMI cable. These I can list with e.g. "aplay -l". Is there any way to figure out which ones correspond?

* Is there a way to enumerate these and, from the enumeration, procure pairs of monitor identifiers and audio device identifiers?

* Is there a way to find a corresponding audio device identifier starting with a monitor identifier? Vice versa?

* What is the authoritative way to refer to these devices? "xrandr --listactivemonitors" describes monitors with strings like "eDP" and "DisplayPort-8" on my system, and assigns them numbers. Meanwhile, "aplay -l" seems to identify sound sinks with the combination of a card number and a device number. From what I've read, the most direct way to refer to a device is a string like "hw:0,3". These don't seem to have anything in common whatsoever. Is there some centralized namespace where both of these things coexist? /dev? /proc? If so, is there a way to go between the authoritative name and device names/numbers that are used at the top end? I ask in case this would provide some way to figure out that the two logical devices of different types are actually part of the same physical device.

* Is the Device Tree relevant here?

Thanks,

Jonathan Gilbert