FAQ007
From the ALSA wiki
| The FAQs have been reorganized. The new location of this question is FAQ# How can I check whether ALSA works? |
How can I check whether ALSA is working?
First of all, have a look at the output of lsmod. It should show quite a few modules starting with "snd-" or "snd_". This is, of course, only the case if the ALSA modules are not built into the kernel.
The single most important module to be loaded is the driver module for your card. In my case it is the terratec dmx xfire 1024 module [snd-cs46xx]:
tapas@mango:~$ lsmod |grep snd-cs46xx snd-cs46xx 72808 3 snd-ac97-codec 49532 0 [snd-cs46xx] snd-pcm 67168 1 [snd-pcm-oss snd-cs46xx] snd-page-alloc 7028 0 [snd-cs46xx snd-pcm] snd-rawmidi 15456 0 [snd-cs46xx] snd 35460 2 [snd-pcm-oss \ snd-mixer-oss snd-cs46xx snd-ac97-codec snd-pcm snd-rawmidi \ snd-seq-dummy snd-seq snd-timer snd-seq-device]
(the above "snd" line is artifically wrapped, remove the \ chars and put the snd-* items all on one line)
The above command also show which modules snd-cs46xx depends upon. There's quite a few low-level alsa modules, which provide alsas basic infrastructure.
Next thing is to use
cat /proc/asound/version
This should show you the installed ALSA version. If you get an error, chances are that ALSA is not loaded.
If you get an output like:
tapas@mango:~$ cat /proc/asound/version Advanced Linux Sound Architecture Driver Version 1.0.2a. Compiled on Feb 3 2004 for kernel 2.4.22 (SMP) with versioned symbols.
you know that at least the basic ALSA infrastructure is loaded. Next try:
cat /proc/asound/cards
It should show something like this:
tapas@mango:~$ cat /proc/asound/cards
0 [CS46xx ]: CS46xx - Sound Fusion CS46xx
Sound Fusion CS46xx at 0xcffef000/0xcfe00000, irq 5
Of course with your card info. Lastly check /proc/asound/devices for a list of the supported hardware devices on your card[s].
Use the aplay program to test the devices. You need to have a .wav file ready to send to the soundcard. If you don't have a .wav file available you can use mpg123 to convert a .mp3 file to a .wav file; for example, you could use mpg123 -w file.wav file.mp3.
aplay file_name.wav
should play the file via the default pcm-device. If you hear nothing but also do not get an error message, chances are that your sound is just muted. Make sure that "Master" is unmuted using "alsamixer" (use arrow keys and "m") or "alsamixergui" (click on top of the bar). If you get an error message about "permission denied" or similar, then the permissions of the alsa device files are not setup correctly (see ls -l /dev/snd/*). If you get an error message about mismatching sample rates, period sizes, etc, then the wav file you tried to play does not "fit" the PCM device. You can specify a different PCM device via the -D switch. This can be useful to test rear/front outputs or digital outputs:
aplay -Dfront file_name.wav
aplay -Drear file_name.wav
aplay -Dsurround51 file_name.wav
are some examples. Use aplay -L to list all available PCM devices.
You can also try the Speaker-Test program to test different setups.

