Audio issues in Ubuntu/Linux

This page lists some of the most common causes of sound not working properly in Ubuntu Karmic. You’re assumed to have checked that your sound system is plugged in and turned on, and that you’ve tried to adjust the settings in the volume control applet, and that things still don’t work properly.

Usual problems with Sound/Audio in Karmic

Wrong kernel version

A lot of people that have upgraded from Jaunty to Karmic are still running Jaunty’s kernel. The result is sometimes that the sound does not work.

Diagnosis

Open a terminal and enter this command:

uname -r

If the result does not start with “2.6.31”, you are running the wrong kernel.

Fix / Workaround

Open a terminal and enter this command:

sudo update-grub

and reboot your system. After rebooting, verify that you’re running the right kernel with “uname -r” as suggested above. If this did not work, please see the documentation for grub for further troubleshooting.

Sound drivers need to be updated

Some computers, especially new ones, have hardware whose drivers didn’t reach standard Karmic. Fortunately, newer sound drivers (ALSA 1.0.21) are just a few clicks away.

Diagnosis

Updating is often worth a try if your sound is not working at all, your mic input is not working, if you have problems with Jack sense (speaker doesn’t auto-mute when plugging in headphones), etc. In addition, here’s an indication that you definitely should try it:

Open a terminal and enter this command:

dmesg | grep -i hda

If you now get a row saying “trying auto-probe from BIOS” or “switching to single_cmd mode”, it is likely that it is fixed in newer sound drivers. (But even if it doesn’t, it could still be worth a try.)

Fix / Workaround

Install the “linux-backports-modules-alsa-karmic-generic” package (or “linux-backports-modules-alsa-karmic-server” for Ubuntu Server edition). For changes to take effect, you must reboot your system afterwards.

The Ubuntu audio dev PPA contains builds of daily stable alsa-driver snapshots prefixed with linux-alsa-driver-modules. If the above package does not work, remove it and try the version in the PPA.

Another process locking the sound card

On the lowest level, only one application can use the sound card at a time. To enable multiple applications to use the sound card simultaneously, you need a sound server, and most Ubuntu editions use PulseAudio as sound server. However, if an application manages to grab the sound card before PulseAudio does, sound will not work.

Diagnosis

In the volume control applet, PulseAudio lists a dummy/null sink.

Open a terminal and enter this command:

sudo fuser -v /dev/dsp* /dev/snd/* /dev/seq*

If you see something else than “pulseaudio” in the rightmost column, such as “slmodemd” or “timidity”, you’re affected.

Fix / Workaround

The workaround depends on what process you saw blocking the sound card.

slmodemd

The slmodemd is a daemon related to your modem, which is known to sometimes block audio. You can get rid of this problem permanently by doing one of these things:

  • Use the PulseAudio package available in the Ubuntu audio dev PPA
  • Uninstall the sl-modem-daemon package (if you don’t use the modem).
  • Upgrade to Lucid (if you know what it means to run a development version of Ubuntu).

Otherwise; follow the instructions below.

Timidity

Timidity is a MIDI file player. You can reconfigure it to use the esound protocol (which pulseaudio implements) by editing the file /etc/default/timidity (you’ll have to be root to do that). Find the row saying ‘TIM_ALSASEQPARAMS=”-Os”‘ and change it to:

TIM_ALSASEQPARAMS="-Oe"

Then restart timidity:

sudo /etc/init.d/timidity force-reload

others

Kill the application locking the soundcard using the killall command. For example:

killall slmodemd

…if it was “slmodemd” that was locking the sound card. Ensure that the problem was fixed by retrying the “sudo fuser -v /dev/dsp* /dev/snd/*” command.

Then restart PulseAudio with the following command:

killall pulseaudio

PulseAudio will then autospawn (restart itself).

Depending on what process you just killed, you might have to take different measures to make sure it does not try to start it again, or reconfigure it not to grab the sound card exclusively.

Advanced mixer (volume control)

The ALSA volume control is hidden in Karmic, because you normally do not need to mess with it (most things you need are in the new volume control applet). But in some cases you still need to access the ALSA-level volume control.

Diagnosis

Volume is muted or very low, you need to enable an unusual mixer item, etc. Sometimes whether digital output is muted or not can affect whether analog output works, and vice versa.

Fix / workaround

Open a terminal, then enter this command:

alsamixer

or to specify the first sound card:

alsamixer -Dhw:0

All the things you can do with alsamixer is beyond the scope of this wiki page, but you can probably read what you need to know about alsamixer by entering this command:

man alsamixer

Volume range anomalies

The latest version of PulseAudio tries to control the volume of the sound card using its mixer controls. Usually this works just fine, but in some cases this does not work properly. (Whether this is PulseAudio‘s or ALSA’s fault is beyond the scope of this wiki page. Some more background information is here.)

Diagnosis

You experience any of the following:

  • Jumps in volume, e g if everything below 20% is muted, and 21% is very loud.
  • Overdriven (distorted sound) if the volume is set above a certain (low) level
  • No volume changes in parts of the range, e g if 20% is just as loud as 70%.

Fix / Workaround

There are a few variables which control how PulseAudio controls the volume. You can either edit /etc/pulse/default.pa (you’ll have to be root to do that) to change the behavior for all users, or copy that file to ~/.pulse/default.pa and then edit that file, to change behavior for the current user only.

Open the file mentioned above. Find the row saying “load-module module-udev-detect” and change it to:

load-module module-udev-detect ignore_dB=1

To try your changes, restart PulseAudio with the following command:

killall pulseaudio

PulseAudio will then autospawn (restart itself).

You may find that the above workaround is insufficient, in which case you may configure PulseAudio to control only one mixer control, e.g., PCM (cf. alsamixer). Find the row saying “#load-module module-alsa-sink” and change it to:

load-module module-alsa-sink control=PCM

(remember to remove the # in the beginning of the row!) Optionally replace PCM with the mixer control you want PulseAudio to control.

You will then need to killall pulseaudio as above and allow the daemon to autospawn.

Volume not stored, or muted after reboots

Debugging in progress.

Fix/workaround

Either re-enable the volume in the normal volume control or in alsamixer, or set up a script to set volumes when you login. You can use the “amixer set” command for this purpose. More information to follow.

No sound or stuttering sound in SDL-based games

Many games use the SDL library, however, by default, only the ALSA version of SDL is installed. Some games are known to work better if you instead use the PulseAudio version of SDL. This is due to a bug in alsa-plugins.

Diagnosis

Open synaptic and select the package which contains the game. Right-click on the package and select Properties. Go to the tab “dependencies” and select “dependencies” in the combobox. If “libsdl1.2debian” is listed as a dependency, then the game is affected.

Fix / workaround

Install the package libsdl1.2debian-pulseaudio, then restart your game.

Less common causes worth mentioning

Alternate channel mappings needed for ICE1712

Cards such as Audiophile 2496, Delta 1010LT and others using the ICE1712 chip, there is a bug with the channel mapping.

Diagnosis

Open a terminal, then enter this command:

cat /proc/asound/cards | grep ICE1712

If you get a line specifying the name of your soundcard, you’re probably affected.

Fix / workaround

See bug #178442.

Cards needing non-free firmware

Some less common cards need firmware code to be downloaded to the card at boot-up. Ubuntu has chosen not to include this firmware because of licence ambiguities or outright illegalities in some regions.

Diagnosis

Open a terminal, then enter this command:

dmesg | grep firmware

If you get a line something like “firmware: xxx not found.” (where xxx is similar to the name of your soundcard or soundcard chipset), you’re affected.

Fix / workaround

You need to install alsa-firmware: pre-packaged versions of alsa-firmware is available at Medibuntu. Also make sure you have the alsa-firmware-loaders package installed, available at the normal Ubuntu repository. After having installed these two packages, reboot your computer.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: