General guidelines on getting sound to work
- Ok! So your audio is not working when you login as normal user.
Are you sure it doesn't work? Try turning up the volume first -- both on your speakers and in Linux. You can use the volume control in your desktop panel, or the sound mixer application in your applications menu, or run alsamixer or aumix in a terminal.
- Login as root and see if the sound works for the root account.
- If sound works for root account but not for a normal user, then you need to add the user to the audio group. This can be done by running the command
adduser your_user_name audio
- As root. Or use the users and groups settings application. You need to log out of the user account and log back in to see the effect of the above command. To check whether a given user is in audio group or not use the id command. For example on my system, this is the output of the id command.
id uid=1000(rajulocal) gid=1000(rajulocal) groups=4(adm),20(dialout),24(cdrom), 25(floppy),29(audio),40(src),44(video),114(plugdev),1000(rajulocal)
- If sound does not work for root account as well, then that means that either your sound card is not supported by Debian or it was not configured properly. But in order to know which one is the case, you first need to know 'what your sound card actually is'!
One common case is when you find that your card starts working after you do a manual alsaconf. This usually happens because you have several sound cards and the audio is being output on the card you don't want. The solution consists of manually defining the default card. To solve this you could see this alsa FAQ
- The make and model of sound card can be obtained by doing
lspci -v This generates lot of output. Browse through the output to find sections about "audio controllers" -- your sound card(s). For example on my system, when I run the above command, I get
0000:00:1f.5 Multimedia audio controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) AC'97 Audio Controller (rev 02) Subsystem: Toshiba America Info Systems: Unknown device ff00 Flags: bus master, medium devsel, latency 0, IRQ 185 I/O ports at 1c00 [size=256] I/O ports at 18c0 [size=64] Memory at c0000c00 (32-bit, non-prefetchable) [size=512] Memory at c0000800 (32-bit, non-prefetchable) [size=256] Capabilities: <available only to root>Be sure to post this piece of information if you are asking a question about sound problems on a mailing list such as debian-user.
Error Messages
If a program gives vague error messages, installing an app which gives more detailed error messages may help. For example, xmms gives very good error messages. When you get it all working, please update this page with the specific error messages & symptoms to help other people who search for these details.
error opening mixer
This error may occur is the sound system is not fully configured.
/dev/dsp: Permission denied
An [error] will occur, if the [user] does not have [permission] to use the [audio] device:
Error: /dev/dsp: Permission denied
The user is required to be a member of the audio [group] to use the audio [device].
Error: /dev/dsp: No such file or directory
The /dev/dsp device is used by audio programs that use the open sound system. If the system is using udev, it may be necessary to install the oss-compat package:
apt-get install oss-compat
Error: audio: /dev/dsp: No such file or directory
If the audio mixer application is reporting that no mixer is available, or gives an error:
- audio: /dev/dsp: No such file or directory
It is necessary to load the snd-pcm-oss module.
Information for developers
Note to developers: it's helpful to remember that the easier it is to get an app running, particularly the first time after installation, the more likely the user is to start & keep on using your app. There are plenty of alternative apps! Having more detailed error messages (see xmms below) is extremely helpful to newer, as well as more experienced, users. Even experienced users won't be knowledgable in every speciality. OK, if you're developing an audio app, your audio infrastructure will already be set up, so looking here and in SoundConfiguration will give a good indication of alternative things which may need setting up before the app will work fully. It helps to have both detailed error messages in the code and guidance in the FAQ, etc. Some useful example messages to distinguish: device /dev/x does not exist; device /dev/dsp does not have write permissions for this user; device /dev/dsp is in use by another program ...
- Q: Which audio/sound apps can I use?
A: See "Install packages .." in SoundConfiguration
- Q: Should I choose OSS or ALSA soundcard drivers?
A: ALSA is free. It is the standard in Linux >= 2.6. It has features such as full duplex, digital I/O etc. (It also has an "OSS emulation" feature to support programs that still use the older OSS interface.)
A: OSS is free, It was the standard in Linux <= 2.4. "OSS" refers to a tradditional, standard way for audio to work on various Unix-like systems. It has the poorest support for soundcards and features, and has various limitations that ALSA doesn't.
- A: There is also a commercial product called OSS/Linux (Open Sound system for Linux), a closed-source alternative OSS implementation for Linux by 4Front Technologies. It is nonfree/non-gratis. It however can auto-detect cards, supports some more hardware and features, and there is a nice user interface.
Q: Is there an introductory article anywhere that can explain what all the various pieces of the Linux sound "architecture" are; that is, what drivers are needed, what is a mixer and how many of those do I need installed, what is OSS (Open Sound System), what is ALSA, etc?
A: I'll introduce "The Book of Linux Sound and Music" to you, which is by No Starch Press and Linux Journal Press. It contains much useful information about Linux sound and music. --CyberWorker
OSS is the Open Sound System, which has been in the Kernel for ages already. It works with sound modules, and there was a non-free extension to support soundcards whose support in the kernel was weak.
ALSA supports more hardware. How difficult it is to set up depends if your card supports plug and play or if you have to find the irqs by hand. I had the kernel-source installed and then alsa-source, compiling it with the kernel-package. That worked brillantly for my SBLive.
Q: How do I check which of OSS (Open Sound System), ALSA, & etc. I have installed?
A1: At least on Sarge lsmod shows "oss" in the module names when using OSS.
- An: ???
- Q: How to enable ALSA OSS emulation?
A1: kernel mode emulation:
apt-get install alsa-oss modprobe snd_pcm_oss modprobe snd_mixer_oss
and you can add snd_pcm_oss and snd_mixer_oss to /etc/modules to load them at boottimeA2: userspace mode emulation:
apt-get install alsa-oss aoss program_to_use_oss
- Q: A program can't play sound and shows an error similar to "failed to open audio device /dev/dsp".
- A: This program is trying to use the OSS sound output device, but some other program has opened it and is using it (only one program at a time can generally play sound with OSS). You need to find that program and cause it to close the device (perhaps by exiting/killing it). See the next question for how.
- Q: How do I tell which other program is using /dev/dsp and preventing other programs from using it?
A: Run one of these commands in a terminal
/bin/fuser -v /dev/dsp /usr/sbin/lsof | grep dsp /usr/sbin/lsof | grep pcm
- Q: How do I do a basic low-level test of my soundcard (lower than playing sound files in a media application)?
A: First enable OSS emulation if you are using ALSA (See above). set the volume fairly low
and as root, just send any file to the audio device. In a terminal run: cat anyfile >/dev/dsp cat anyfile >/dev/dsp1
if the file is a WAV file that happens to be in the right internal format, it might play correctly:
cat example.wav >/dev/dsp
- Q: can't open /dev/dsp: No such device
- A: This means that the driver was not loaded successfully or that it didn't find any devices. Try 'lsmod' to see what modules are loaded and 'dmesg' to see what they said when they where loaded.
Specific apps
Q: xmms gives a dialog box with:
Please check that: 1. You have the correct output plugin selected. 2. No other programs is/are blocking the soundcards. 3. Your soundcard is configured properly.
A: run it from a terminal, where it gives more helpful detailed messages eg:
WARNING: oss_open(): Failed to open audio device (/dev/dsp): Device or resource busy WARNING: oss_open(): Failed to open audio device (/dev/dsp): Permission denied
See SoundConfiguration or the next question for details on fixing these.
- Q: "device /dev/dsp can't be opened (Device or resource busy)" or "failed to open audio device /dev/dsp"
- A: This usually means another program has exclusive access to the OSS sound device. To find out which, try 'lsof' (List Open Files) and search for /dev/dsp or /dev/snd/pcm files. Then exit the program using the device or get it to close the device.
- When running kde, gnome or enlightenment, you might also consider running the failed program with :
- 'esddsp progname' (enlightenment, gnome)
- 'artsdsp progname' (KDE)
Q: mpg321 gives:
libao - OSS cannot set rate to 44100 Can't find a suitable libao driver. (Is device in use?)
- A: Try apt-get install libsamplerate0
- A: Alternatively, you may have a sound system that only supports 48khz. libao doesn't support resampling, so use libmad/madplay as an alternative.
- A: Is alsa's OSS emulation loaded? Try: "modprobe snd-pcm-oss" as root.
Q: mpg321 gives:
Can't find a suitable libao driver. (Is device in use?), or Can't open libao driver with device /dev/dsp (is device in use?)
A: See "use 'adduser. .. audio' " in SoundConfiguration
- Q: I have installed a new linux kernel and suddenly my alsa sound does not work.
- A: If you install a new kernel version you also need to install the corresponding alsa-modules version.
A: If you installed a 2.6 kernel for the first time, consider what smokybobo wrote at Linuxquestions.org. In addition, consider running 'alsamixer' and unmute the channels you need and set them to an appropriate volume. Make sure you set the option to saving the mixer settings across reboots in the alsa-base configuration. At that point, e.g. XMMS should work with the output plugin ALSA. If you are running KDE and you want it's sound effects as well, you may have to tell it's aRts server explicitely to use ALSA. In that case, you'll have to set the output plugin for XMMS to aRts. --DavidAndel
A: I had installed a kernel image of 2.6.5-4 and found that coupled with the direction in the link above and an upgrade to 2.6.6-1, I had ALSA support in all of my applications. Also, if you have multiple capture cards (bttv, other tuner, radio card), try "cat /proc/asound/cards" to verify that your capture card is where you expect it. For my system, the tv card registered as card 0 and a SB Live! came up as card 1. --EricZavesky
Related Links: SoundConfiguration