28-06-06 - version 0.1 - initial creation28-06-06 - version 0.2 - alsa-source guide added28-06-06 - version 0.3 - alsa-drivers from alsa-project guide added29-06-06 - version 0.4 - multiple sounds and multiple cards support added02-07-06 - version 0.4 - fixed mistake spotted by Jvaldezjr04-07-06 - version 0.5a - layout changes - starting on MIDI guide - Read *EXPERIMENTAL*04-07-06 - version 0.5a - added part on saving sound settings so they are restored after reboot.11-07-06 - version 0.5b - added guide for doing a *fresh* kernel installation13-07-06 - version 0.5c - minor layout edit - moved *fresh* kernel above compilation to see if it is more help and if it solves more problems.15-07-06 - version 0.5d - usage update17-07-06 - version 0.5e - added Advanced Guides by other Ubuntuers21-08-06 - Initial phase of moving page to UDSF23-08-06 - Added a Further Reading section - first link thanks to segalion.12-11-06 - version 0.6 - finally added "Adding the current user to the audio group" - and a few formatting fixes

Background / Notes / Warnings

I can't guarantee if these instructions will work for everybody, and this is definitely a work in progress. But if these instructions can at least help one person out, I'll be happy.

If anyone has any suggestions or tips in making this post better, feel free to PM me or post below. Credits will be given regardless of how small the improvement.

If you find that you have followed the instructions on this post that something did not and you don't know why, it will be better if you start a new post and cite the fact that you used the instructions on this guide to solve your problem. Your post might get lost in all the other posts and you might not get help.

If you however find a solution to your problem, and you fee that the solution should be here, don't hesistate to post. However, please be specific.

If you cannot use hear anything, and you have just installed Ubuntu, then it could very possibly be a bug. It could be something as simple as not detecting your hardware the first time or evidence of a deeper problem. As fun as it is to find workarounds and fixes on your own or with help, Ubuntu developers need your feedback to see what is not working for you. That's right ladies and gentlemen, they would really really like it if you would file bug reports onhttp://launchpad.net under the Ubuntu distribution.

Note: To make it absolutely clear, when I say 'Ubuntu', I mean Ubuntu AND Kubuntu AND Xubuntu (for people who find this confusing - just accept it and don't feel bad - I and probably a whole lot others got confused when we started out).

Important syntax note: ALSA modules are denoted by the prefix 'snd' followed by the dash ' - ', followed by the module name (i.e. 'via82xx'). So the full name might be something like snd-via82xx. However, in some cases you will see an underscore ' _ ' instead of the dash. This is OK, do not let it confuse you. For all intensive purposes (installing modules or posting on forums) only use the dash ' - '.

General Help - Start here if you have no idea why sound is not playing

(1) Go to a shell and type:

Code:

aplay -l

Success - You will get a list of the all the soundcards installed on your system. Your sound just might be muted. See alsamixer section.

Failure - You will get a message like

Code:

aplay: device_list:221: no soundcard found...

Move on to step 2.

(2) Type this into the shell:

Code:

lspci -v

Success - At this point, you should see your sound card listed. This is a positive sign because it means that Ubuntu is detecting the presence of your soundcard, but the drivers are not installed/running. Leave your shell running since you will need it.

Failure - If it is not listed, then there are a few things that you can do.

If your soundcard is an onboard sound card, then it might be disabled in the system's BIOS. You will have to reboot and hit the key that lets you enter into the BIOS (usually Delete, F2, or F8).

If your soundcard is not onboard, make sure that it is properly seated in the PCI slot. If your card is working under Windows then this is not a problem.

(3) Check to see if the ALSA driver for your sound card exists. Go to http://www.alsa-project.org/alsa-doc/ and search for your sound card (chipset) manufacturer in the dropdown box. You'll be given a matrix of the sound cards made by the manufacturer. Try to match the chipset you found in step 2 with the driver(green hyperlink text).

Success - You will have found the driver for your soundcard's chipset.

Failure - You will have not found the driver for your soundcard chipset. (at the moment I cannot help you, but stay tuned!)

(4) Now go back to the shell and type

Code:

sudo modprobe snd-

Now, press the TAB key BEFORE pressing the ENTER key to see a list of modules. Try to find the module that matches the driver you found in step 3.

For example, my driver is a via82xx so I would type, sudo modprobe snd-via82xx.

Success

A success here means that your soundcard was installed, but it was not being loaded. Now you have loaded it for the current session.

To load it for all sessions (you will probably want to do this) you will have to edit /etc/modules (I think this is the file, I'll check once I get to my Dapper PC).

Type this into the shell

Code:

sudo nano /etc/modules

Add only the name of the module to be loaded at the end of the file. In my case, the via82xx module gave me sound so I added "snd-via82xx" to the end of the file.(iii) Make sure that you have all channels unmuted in alsamixer

See the alsamixer section

Play media using your favorite media player. Set your audio engine to alsa. In some cases, you have to configure your audio engine within another (media engine) like in Kaffiene in Kubuntu. If you hear sound, hurray!

One final step. Go onto Saving Sound Settings

Failure -You have two options

Move on to Getting the ALSA drivers from a *fresh* kernel. This step is easier and is recommended to users who might have been tinkering with their sound settings and want to revert back to the way it was just after installing Ubuntu (without reinstalling Ubuntu of course )

Move on to ALSA driver Compilation, if you have not done so already. If you have, please post a new thread with your problem.

Getting the ALSA drivers from a *fresh* kernel

Sometimes, sound might be configured correctly, but for some reason or another (tinkering) it stops working. One way to go back to the old setup is to reinstall Ubuntu. However, this step is actually quite unnecessary since you are reinstalling everything because of one thing.

A faster way, is to just remove the problematic packages and reinstall them cleanly.

(1) Remove these packages

Code:

sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils

(2) Reinstall those same packages

Code:

sudo apt-get install linux-sound-base alsa-base alsa-utils

[LIST][*]

VERY IMPORTANT NOTE: Ubuntu (GNOME) users have reported that packages 'gdm' and 'ubuntu-desktop' are removed after removing the linux-sound-base packages. If this happens, then do the following

Code:

sudo apt-get install gdm ubuntu-desktop

(3) Reboot

[*][LEFT]

VERY IMPORTANT NOTE: Xubuntu (XFCE) users have reported that packages 'gdm' and 'xubuntu-desktop' are removed after removing the linux-sound-base packages. If this happens, then do the following

Code:

sudo apt-get install gdm xubuntu-desktop

(3) RebootNow you may ask "I already had the packages, so why did I go through the trouble of removing them, then installing them". The answer lies in the --purge option which removes all the extra information that accumulated from tinkering and upgrading. After doing a purge then install, the packages are unpackaged as if it they are brand new.(4) At this point, try using

Code:

aplay -l

you should get your soundcard listed.

Success - Your soundcard is detected. Go onto the Using alsamixer section, then try playing something on your music or media player.

If you are here, then either your soundcard driver could not be loaded with modprobe, or you want to compile the drivers yourself from scratch. Good luck to you!

There are two main ways the sources of alsa-drivers are made available to you. One is though the apt-get system. Using this system would be the recommended system since most of the heavy lifting is done for you.

The other way, is getting the latest drivers from alsa-project.org. This page has the latest drivers available, which you might want to fix problems with. However, these have not been tested with Ubuntu and therefore should be used with caution.

Using alsa-source

Type the following to shell: (note: module-assistant is optional, it will compile the package for you)

You now have a big blue dialog box (left and right keys to choose 'Yes' and 'No', Enter key proceed). Answer yes (for ISA-PNP - recommended by package maintainers), then yes again (for debugging - recommended by package maintainers).

Now you must pick which driver you want to install. Use space to select and deselect modules, and up and down to navigate.

From General Help step 3, you should know the name of your driver. Deselect 'all' (the * will go away), and select your driver. In my case, I deselected 'all' then selected 'via82xx'. Hit Enter. Almost home free!

If you chose module-assistant

Code:

sudo module-assistant a-i alsa-source

If the progress bar reaches 100% with no errors, you will have installed the drivers successfully. Resume this guide from General Help step 4.

If you did not choose module-assistant - Remember the name of your soundcard driver and use it place of the blue text below.

If you get no errors from doing the above then you have successfully compiled alsa-drivers from source. Resume this guide from General Help step 4.

Using alsamixer

Type this into a shell

Code:

alsamixer

You will now see what appears to be a graphical equalizer. It is more like ten different volume controls in the sample place.

To navigate around:

Left and Right Arrow Keys - Move left and right (if you move long enough in one direction you will get back to where you started - you will not fall off the screen )

Up and Down Arrow Keys - Increase and decrease volume respectively.

Letter M Key - Mutes/unmutes. If a channel is unmuted, then there is a green box underneath the volume slider. If the channel is muted, the box is grey.

Saving Sound SettingsDo this step to ensure that your alsamixer settings are reloaded with each boot. First make sure you have your settings just the way you like them in alsamixer. Then do

Code:

sudo alsactl store 0

or if this is your nth sound card (where n is the number of soundcards in your computer) replace 0 with n-1. Many thanks to xpix for trying this out.-

Getting more than one application to use the soundcard at the same time

You might want to play a game and listen to music on your favorite music player at the same time. To do this successfully, you will have to use ALSA since it supports this feature the best. On all the music players I know of, you can configure the sound engine, to any module that is available.

The setting is usually found under something like Tools >>> Configure >>> Player Engines.

For games, it is a bit more tricky since there is not always a way to configure the player engine directly. Most games, however, do support the OSS. ALSA has an OSS module that allows OSS applications to use the ALSA driver.

To do this you will need the alsa-oss package

Code:

sudo apt-get install alsa-oss

After doing this step, it is very easy to use alsa-oss. In the shell, you can type 'aoss' then the name of the program name you want to use with alsa-oss.

Note: This section assumes that you have installed each soundcard properly.

In a shell, type

Code:

cat /proc/asound/modules

This will give the the name and index of each soundcard you have currently. Make a note of the names, and decide which one you want to be the default card.

Now type

Code:

sudo nano /etc/modprobe.d/alsa-base

At the very end of the file, add the following (assuming you have 3 cards with module names A, B and C and you want to have them in the order CAB)

Code:

options snd-C index=0

options snd-A index=1options snd-B index=2

Adding the current user to the audio group

A very common cause for a user to not have sound is not having his/her username in the /etc/group.

Thanks to rustybutt for this simple check.

Code:

grep 'audio' /etc/group

You should see a line similar to

Code:

audio:x:29:

followed by a username i.e. if the username is "ubuntu" then you should see

Code:

audio:x:29:ubuntu

. If you see something else i.e.

Code:

audio:x:29:root

you should add your username to the file by doing

Code:

sudo nano /etc/group

. Now find the line that looks like

Code:

audio:x:29:root

and change it to

Code:

audio:x:29:root:moocow

only replacing moocow with your real username.

Hit CTRL + 0 to save, then CTRL + X to exit. That's the end of that

Getting MIDI To Work - *EXPERIMENTAL*

This section assumes you can successfully hear sound from your soundcard.

First of all, make sure that you actually have a MIDI port on your soundcard. Most onboard soundcards do not have a MIDI port.

Next, open up this file:

Code:

sudo nano /etc/modprobe.d/alsa-base

Then add this options line

Code:

options <snd module name here i.e. snd-via82xx> mpu_port=0x330

OR if you already have a options line for this soundcard add

Code:

mpu_port=0x330

to the line.

The default MIDI port is 330. You should verify this number in your BIOS if you are not sure. If the number is not listed, it is most likely that the number is 330 (add the 0x for the file).

If you get no errors, you have successfully installed your MIDI port. At the moment, I do not know if any further configuration is necessary.

Miscellaneous Tips and Tricks

Here are a few things that other people have dug up over the course of this guide. Not all tips are meant to work for all hardware (believe me hda-intel will probably have like a mini guide of it's own one day).

The crucial thing is to enable everything in alsamixer EXCEPT "external amplifier." (I had to turn off microphone too, to stop feedback).

Useff had a very annoying problem where he could get sound through alsa from one user, but not through is main account. http://www.ubuntuforums.org/showthread.php?p=1221754. Him and I managed to fix the problem by making sure the main account was in the audio group in /etc/groups (which he was) and deleting the .asoundrc file in the main account's /home directory.

Bo Rosén solved his ISA problem the following way. Thanks to FarEast for his help in the matter.

(I personally like the non-keytouch route - configuring xmodmap and then using gnome-keybindings or for KDE (System Settings >> Regional and Language Settings >> Keyboard Shortcuts). The xmodmap route also works for XFCE, but I do not how to configure XFCE application keybindings.

Re: Comprehensive Sound Problem Solutions Guide

Bumping this post since I think it is ready to be used by people having trouble with sound. I'll do my best to field questions and make changes to this guide as needed. If you are an experienced Ubuntu user, please help out with testing, verifying, and helping people who use this guide.

Re: Comprehensive Sound Problem Solutions Guide

Excellent. Thank you.
I had a problem with multiple card switching and reported it as a bug. Are options in alsa-base (also suggested to me on launchpad) workaround or solution?
Im definitely interested in midi (new yamaha dx-305 sitting just next to pc).

Re: Comprehensive Sound Problem Solutions Guide

Options in alsa-base would be a solution. alsa-base is a part of the official Ubuntu Repositories, so they would be considered a solution. The alsa-drivers from alsa-project would be considered a workaround until Ubuntu incorporates the official 1.0.11 stable into alsa-base.

Re: Comprehensive Sound Problem Solutions Guide

Excellent guide- I've just reinstalled Dapper, so I'll retry my sound issues with this guide, and see what happens.

**Update***
I went through the steps like you mentioned, and I believe it is working like it is supposed to. I'll post if I have more problems in another thread, but as of right now I'm getting 5.1 sound. The only problem I had was when I rebuilding the alsa drivers with alsa-source. The command "dpkg-reconfigure alsa-base" didn't produce anything- there was a pause at the prompt, then that was it. Something ran, but I got no feedback as to what it did. So I went through the steps with the module-assistant method, and so far so good.

Also, I never was able to get any output when I did "sudo modprobe snd-" and hit tab. So I went through with the loading the module anyway (my case it was snd-intel8x0). When I added that module to my /etc/modules file and rebooted, I believe that fixed it. However, when I checked to see if the module was loaded (lsmod | grep snd) the only thing I saw that was close to snd-intel8x0 was snd_intel8x0. Is there a different between using the - and the _ , or is it still the same module, and should I have added snd_intel8x0 to /etc/modules?

Re: Comprehensive Sound Problem Solutions Guide

Jvaldezjr - Thanks for the comments - you found an error in my instructions - it was supposed to read

Code:

sudo apt-get dpkg-reconfigure alsa-source

not alsa-base. In the alsa-project wiki, using a - and a _ are the same thing. They just appear in different areas.

ubuntu_demon - thanks for the comments and the sticky!!!

linish - glad I could help. Video gets a bit tricky and most of the work has been done. I might make a guide that links to all the relevant guides for ATI/NVIDIA/free drivers.

acorn22 - thanks for the comments. I tried to make it as new-user friendly as possible and I assume that the new-user has no previous knowledge whatsoever. This characteristic, IMO, makes the guide longer, but more thorough and less ambiguous.