Configuring Sound on Linux/HW Address

This document will teach you how to find an address and confirm it is working.

Using aplay
The stock ALSA utility aplay can tell you the hardware addresses of the devices it is ready to use. Simply supply to aplay the --list-devices argument.

Note, for this card the notation for the physical address would be hw:0,3. While the device name, is HDMI

Using /proc
Here we will use proc to query our kernel for information.

By viewing the virtual file /proc/asound/cards your kernel will show you the device names for the cards it is has ready for use. If your card isn't listed here then your kernel does not support it. The device names can be found in the brackets.

An example of the output for device HDMI might be:

The kernel should have created a virtual directory for each card in /proc/asound. The directories associated with the card will be prefixed by 'card' and suffixed by the number of the card, ex., card0, card1, etc.; i.e., '0' in our example.

Inside of these directories you will find a simple list of files.

The most important file is the pcm3p/info, by examining this file we can finish our search for the hardware coordinates of the sound devices.

Writing the hardware address
Now you know the basics about your card! Specifically, you'll need the card number, and the device number. These two are often seen in ALSA hardware notation as hw:CARD,DEVICE, which is totally dependent on the order the kernel detects them.

Test the address
Firstly, make sure your device in question is un-muted! You can test the functionality of you default card at any time by using the following command:

This will bombard your card with random and totally irrelevant data. Your card will present this data to you in the form of sound à la modem noise. To stop that noise ^D (hold Control and press D). Alternatively, you can use the dd command to flash-test.

Presumably, if you're reading this tutorial your sound isn't working. You might want to explicitly test a sound device, or you might be having problems with the default and want to try out another device. Whatever have you, the -D argument to aplay does just that.

If you hear sound, enjoy—your card works and is fully compatible with your operating system.