Home » Questions » Computers [ Ask a new question ]

What do ALSA devices like "hw:0,0" mean? How do I figure out which to use?

What do ALSA devices like "hw:0,0" mean? How do I figure out which to use?

I've searched over and over and can't find any explanation of what "hw:0,0" means. How do I determine the number of my USB audio card? MPD requires me to enter something like this:

Asked by: Guest | Views: 112
Total answers/comments: 1
Guest [Entry]

"JohnT's answer gives a good basic. I'll follow it up with how to find the devices on your system. Use aplay -l to get a list of the devices on your system. The hw:X,Y comes from this mapping of your hardware -- in this case, X is the card number, while Y is the device number.
$ aplay -l # note lower-case ""L"" option
**** List of PLAYBACK Hardware Devices ****
card 0: T71Space [Terratec Aureon 7.1-Space], device 0: ICE1724 [ICE1724]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: T71Space [Terratec Aureon 7.1-Space], device 1: IEC1724 IEC958 [IEC1724 IEC958]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: T71Space [Terratec Aureon 7.1-Space], device 2: ICE1724 Surrounds [ICE1724 Surround PCM]
Subdevices: 3/3
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2

Since these are USB devices that might not always get the same device numbers each time they're plugged in, the hw:X,Y device might change. The simplest answer is, for a desktop system, try the GNOME/KDE/Xfce configuration tools, and see if they're smart enough to pick up the changes.
The complex way, if you're not doing this with a desktop system, gets ... interesting. You might be able to get away with using device aliases instead of the hw:X,Y -- this is what the output of aplay -L shows. The something:CARD=FOO,DEV=Y stuff is the alias, and probably won't change between different device plug-ins, where the X in hw:X,Y might. (Assuming that you're using the same USB dongle each time.)
$ aplay -L
NVidia CK804, NVidia CK804
Default Audio Device
front:CARD=CK804,DEV=0 # hw:0,0
NVidia CK804, NVidia CK804
Front speakers
surround40:CARD=CK804,DEV=0 # hw:0,1
NVidia CK804, NVidia CK804
4.0 Surround output to Front and Rear speakers

So your aplay command would become aplay -D front:CARD=CK804,DEV=0 somefile.wav, and you can use the same devicename in your .asoundrc.

If you need something more stable at an even lower level, actual kernel devices, udev is what you want -- it's the system that allows for hotplugging devices into the system. You can write rules for udev (and here's the man page) that will allow devices to get the same devicename when plugged in."