个人工具

“UbuntuHelp:SoundTroubleshooting”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/SoundTroubleshooting}} {{Languages|UbuntuHelp:SoundTroubleshooting}} == Background / Notes / Warnings == I can't guarantee if these instructions ...)
 
 
(未显示2个用户的11个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/SoundTroubleshooting}}
 
{{From|https://help.ubuntu.com/community/SoundTroubleshooting}}
 
{{Languages|UbuntuHelp:SoundTroubleshooting}}
 
{{Languages|UbuntuHelp:SoundTroubleshooting}}
== Background / Notes / Warnings ==
+
<<Include(Tag/StyleCleanup)>>
 +
== Basic Troubleshooting Steps ==
 +
'''Note:''' Most of these steps apply equally to Ubuntu, Kubuntu and Xubuntu.  The core of all of these systems is the same, and sound is a "core" functionality.
 +
=== Is your volume turned up, or is the speaker muted? ===
 +
Double click on the "speaker" icon in the upper right hand corner of the screen.  This will launch the Volume Control application, which has various sliders to control the volume.  Make sure that the speaker, headphone and master sliders are not muted, and have the volume up from zero.  On a fresh install of Ubuntu 8.10, the Speaker volume is turned all the way down.
 +
You can launch Gnome Volume Control application using Alt+<F2> and type
 +
<pre><nowiki>
 +
gnome-volume-control
 +
</nowiki></pre>
 +
Re-check the sliders.
 +
=== Can you play a known-good sound? ===
 +
'''aplay''' is part of the '''alsaplayer''' package, and '''Front_Center.wav''' is part of the '''alsa-utils package''', so both are pretty standard. So try to run
 +
<pre><nowiki>
 +
aplay /usr/share/sounds/alsa/Front_Center.wav
 +
</nowiki></pre>
 +
in a terminal. You should hear a voice saying "Front" then "Center". If it doesn't play the first time you run that command, try running it again (it may not play the first time); you can also try running
 +
<pre><nowiki>
 +
aplay /usr/share/sounds/alsa/Front_Left.wav
 +
aplay /usr/share/sounds/alsa/Front_Right.wav
 +
</nowiki></pre>
 +
=== Are you in the sound group? ===
 +
Check that you are in the appropriate group. Depending on your ubuntu version, one of these commands should return something and the other should not:
 +
<pre><nowiki>
 +
fgrep -ie 'audio' /etc/group
 +
fgrep -ie 'sound' /etc/group
 +
</nowiki></pre>
 +
E.g., with karmic, I got
 +
<pre><nowiki>
 +
$ fgrep -ie 'audio' /etc/group
 +
> audio:x:29:pulse
 +
$ fgrep -ie 'sound' /etc/group
 +
</nowiki></pre>
 +
so I backed up then changed '''/etc/group''':
 +
<pre><nowiki>
 +
$ sudo cp /etc/group /etc/group_TODAYSDATE
 +
$ sudo chmod a-wx /etc/group_TODAYSDATE
 +
$ sudo adduser MY_USERNAME audio
 +
$ fgrep -ie 'audio' /etc/group
 +
> audio:x:29:pulse,MY_USERNAME
 +
</nowiki></pre>
 +
=== Is the system recognizing your sound card? ===
 +
Open a terminal window, and type
 +
<pre><nowiki>
 +
sudo aplay -l
 +
</nowiki></pre>
 +
Your output should look something like this:
 +
<pre><nowiki>
 +
**** List of PLAYBACK Hardware Devices ****
 +
card 0: Intel [HDA Intel], device 0: ALC861VD Analog [ALC861VD Analog]
 +
  Subdevices: 0/1
 +
  Subdevice #0: subdevice #0
 +
</nowiki></pre>
 +
If you see <code><nowiki>aplay: device_list:221: no soundcard found...</nowiki></code>, Ubuntu is not recognizing your sound card for playback.  Check that you have the proper modules installed.
 +
=== Do you have the sound modules installed? ===
 +
Open a terminal window, and type
 +
<pre><nowiki>
 +
find /lib/modules/`uname -r` | grep snd
 +
</nowiki></pre>
 +
You should see a whole list of items come up.  If you don't, it means that the upgrade process missed installing the kernel modules for sound.  To fix this, type this at the command line:
 +
<pre><nowiki>
 +
sudo aptitude install linux-ubuntu-modules-`uname -r` linux-generic
 +
</nowiki></pre>
 +
For Ubuntu 9.04 Jaunty Jackalope
 +
<pre><nowiki>
 +
sudo aptitude install linux-restricted-modules-`uname -r` linux-generic
 +
</nowiki></pre>
 +
After installing the modules, you will need to reboot.
 +
If the modules are already installed, proceed to the next step to check to see whether your hardware is recognizing the sound card as installed:
 +
=== Is the sound card physically installed and recognized by your hardware? ===
 +
Open a terminal window, and type
 +
<pre><nowiki>
 +
lspci -v | less
 +
</nowiki></pre>
 +
This will check your computer's motherboard, and attempt to list out all devices that it's recognized as installed.  There is probably a lot of things listed, but the one you're looking for will be labeled "Audio device".  Mine is listed below:
 +
<pre><nowiki>
 +
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
 +
Subsystem: Toshiba America Info Systems Device ff01
 +
Flags: bus master, fast devsel, latency 0, IRQ 22
 +
Memory at dc440000 (64-bit, non-prefetchable) [size=16K]
 +
Capabilities: <access denied>
 +
Kernel driver in use: HDA Intel
 +
Kernel modules: snd-hda-intel
 +
</nowiki></pre>
 +
Most users have a "built in" sound card for their computer on the motherboard.  If yours is built in, and isn't showing up in this step, then you probably need to enable it in your BIOS.  When you first boot, or reboot your computer, there's usually a key sequence telling you how to enter the BIOS Configuration Screen.  You'll need to sort through your BIOS and enable the built in sound card.
 +
If you are not using a built in sound card, and this step does not show your audio card, the card may be seated incorrectly on your motherboard, or may be bad or otherwise incompatible with your motherboard.  You will probably want to test the card in another computer to see if it works there.
 +
=== Is my SoundCard supported? ===
 +
The Advanced Linux Sound Architecture (ALSA) is the system that Ubuntu uses for managing Sound output.  There is a listing of all of the sound cards supported by ALSA at http://www.alsa-project.org/main/index.php/Matrix:Main .  You should look for the information that was listed by <code><nowiki>lspci</nowiki></code> in the previous step.  If it turns out that your soundcard is not supported by ALSA, you have basically two different options: Get a new soundcard that is supported by ALSA, or contact the ALSA developers to request support for your soundcards.
 +
'''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. When mentioning module names (to install them or communicate their names to others) only use the dash ' - '.
 +
=== Is ALSA using the correct model? ===
 +
If you are experiencing problems with your sound card after upgrading to Ubuntu 9.04, it might be because ALSA is using the wrong model for your chipset.
 +
To figure out your chipset you can run this command:
 +
<pre><nowiki>
 +
wget -O alsa-info.sh http://alsa-project.org/alsa-info.sh && bash ./alsa-info.sh
 +
</nowiki></pre>
 +
This will provide you with a URL to a webpage with lots of information about your sound setup. Open it up, and keep it open; you'll need it as a reference.
 +
You can take a look at [http://www.alsa-project.org/db/?f=4e5ca464947959bdf373516314670645493e0dfa this webpage] as a reference.
 +
Now you need to figure out what models are supported by your soundcard. This part is a bit backwards, you have to browse the ALSA git repository.
 +
The repository is located at [http://git.alsa-project.org/?p=alsa-kmirror.git], so open up this URL.
 +
If you look at the webpage with information about your soundsetup, you'll notice it has a section like this:
 +
<pre><nowiki>
 +
!!ALSA Version
 +
!!------------
  
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.
+
Driver version:    1.0.18
 +
Library version:    1.0.18
 +
Utilities version:  1.0.18
 +
</nowiki></pre>
 +
Notice the driver version. This is the version you should be navigating to in the git repository. If you look at the 'tags' section there's a tag called [http://git.alsa-project.org/?p=alsa-kmirror.git;a=commit;h=ba283e5ded21f6585b1f15254d6b4df94638eac2 v1.0.18], which is the one we want.
 +
When I navigated into this tag repository, I also had to click the '''tree''' link on the top of the page to get a directory listing.
 +
Click the [http://git.alsa-project.org/?p=alsa-kmirror.git;a=tree;f=Documentation;h=9f44ec920103d0b6f87bd328b0355e212ad8d614;hb=ba283e5ded21f6585b1f15254d6b4df94638eac2 Documentation] directory, and then click [http://git.alsa-project.org/?p=alsa-kmirror.git;a=blob;f=Documentation/ALSA-Configuration.txt;h=e0e54a27fc10905a62bd649605ad2dbe8f8bfdbf;hb=ba283e5ded21f6585b1f15254d6b4df94638eac2 ALSA-Configuration.txt].
 +
Remember these links are for the v1.0.18 driver version only, you need to find the appropriate '''ALSA-Configuration.txt''' for your driver version.
 +
Now you need to figure out what module is loaded by ALSA on your machine. The [http://www.alsa-project.org/db/?f=4e5ca464947959bdf373516314670645493e0dfa webpage] with all the information about your system comes to the rescue again:
 +
<pre><nowiki>
 +
!!Loaded ALSA modules
 +
!!-------------------
  
'''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 on http://launchpad.net''' under the Ubuntu distribution.
+
snd_hda_intel
 
+
</nowiki></pre>
'''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).
+
You might have to do a bit of digging to find your module in the [http://git.alsa-project.org/?p=alsa-kmirror.git;a=blob;f=Documentation/ALSA-Configuration.txt;h=e0e54a27fc10905a62bd649605ad2dbe8f8bfdbf;hb=ba283e5ded21f6585b1f15254d6b4df94638eac2 ALSA-Configuration.txt] file. For my module, it is in the section called:
 
+
<pre><nowiki>
'''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 ' - '.
+
Module snd-hda-intel
 
+
</nowiki></pre>
== General Help ==
+
Now I have to figured out what Codec my soundcard uses. This is also on the [http://www.alsa-project.org/db/?f=4e5ca464947959bdf373516314670645493e0dfa webpage] with my sound configuration.
'''Start here if you have no idea why sound is not playing'''
+
It has a section that looks like this:
*Go to a shell and type: <code><nowiki>aplay -l</nowiki></code>
+
<pre><nowiki>
*''Success'' - You will get a list of the all the soundcards installed on your system. Your sound just might be muted. See alsamixer section.
+
!!HDA-Intel Codec information
*''Failure'' - You will get a message like <code><nowiki>aplay: device_list:221: no soundcard found... </nowiki></code> Move on to step 2.
+
!!---------------------------
*Type this into the shell: <code><nowiki>lspci -v</nowiki></code>
+
--startcollapse--
**''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.
+
*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!)
+
#Now go back to the shell and type <code><nowiki>sudo modprobe snd-[NAME OF YOUR SOUNDCARD'S DRIVER]</nowiki></code>. 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><nowiki>sudo nano /etc/modules</nowiki></code>
+
**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.
+
*Remove these packages <code><nowiki>sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils</nowiki></code>
+
*Reinstall those same packages <code><nowiki>sudo apt-get install linux-sound-base alsa-base alsa-utils </nowiki></code>
+
*'''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><nowiki>sudo apt-get install gdm ubuntu-desktop</nowiki></code>
+
*'''VERY IMPORTANT NOTE - Xubuntu (XFCE)''':  users have reported that packages 'gdm' and 'ubuntu-desktop' are removed after removing the linux-sound-base. If this happens, then do the following <code><nowiki>sudo apt-get install gdm xubuntu-desktop</nowiki></code>
+
*Reboot
+
*At this point, try using <code><nowiki>aplay -l</nowiki></code> 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.
+
*''Failure'' - Your card was not detected. You should try compiling your driver, so go onto ALSA drive Compilation.
+
 
+
Now 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.
+
  
 +
Codec: SigmaTel STAC9227
 +
</nowiki></pre>
 +
Now take a look at [http://git.alsa-project.org/?p=alsa-kmirror.git;a=blob;f=Documentation/ALSA-Configuration.txt;h=e0e54a27fc10905a62bd649605ad2dbe8f8bfdbf;hb=ba283e5ded21f6585b1f15254d6b4df94638eac2 ALSA-Configuration.txt] again, and you will find a section that looks like this, which matches up with my soundcards codec:
 +
<pre><nowiki>
 +
  STAC9227/9228/9229/927x
 +
  ref          Reference board
 +
  3stack        D965 3stack
 +
  5stack        D965 5stack + SPDIF
 +
  dell-3stack  Dell Dimension E520
 +
  dell-bios    Fixes with Dell BIOS setup
 +
</nowiki></pre>
 +
A stack is the same as a jack plug in your soundcard.
 +
By inspecting your computer you have to figure out how many jacks you have on your soundcard. I have six jacks in the back and two in the front of my computer, so I chose the '''5stack''' model configuration.
 +
So armed with this knowledge, it's about time to start configuring your system.
 +
This is the steps that were necessary to get a Dell Dimension E520 with Intel HDA and SigmaTel STAC9227 Codec to work after upgrading to Ubuntu 9.04:
 +
<pre><nowiki>
 +
sudo nano /etc/modprobe.d/alsa-base.conf
 +
</nowiki></pre>
 +
This part will depend on your soundcard, it consists of the module name ('''snd-hda-intel''') and the model I found in [http://git.alsa-project.org/?p=alsa-kmirror.git;a=blob;f=Documentation/ALSA-Configuration.txt;h=e0e54a27fc10905a62bd649605ad2dbe8f8bfdbf;hb=ba283e5ded21f6585b1f15254d6b4df94638eac2 ALSA-Configuration.txt], '''5stack''':
 +
<pre><nowiki>
 +
options snd-hda-intel model=5stack
 +
</nowiki></pre>
 +
And finally:
 +
<pre><nowiki>
 +
sudo alsa force-reload
 +
</nowiki></pre>
 +
== Manual Installation ==
 +
Once you've done the basic troubleshooting listed above, if things still aren't working, you may have found a bug in Ubuntu. It could be something as simple as not detecting your hardware the first time or evidence of a deeper problem. Ubuntu developers need your feedback to see what is not working for you. If you've reached this point, you should file a bug report on http://launchpad.net  under the Ubuntu distribution.  You should probably include the lspci and aplay output listed above in your bug report.  Filing a bug report may seem like a worthless exercise, but it really helps in the development process.
 +
=== Manually starting the Audio driver ===
 +
Open a terminal and type <code><nowiki>sudo modprobe snd-[NAME OF YOUR SOUNDCARD'S DRIVER]</nowiki></code>. For example, my driver is a via82xx so I would type, <code><nowiki>sudo modprobe snd-via82xx</nowiki></code>.
 +
After this, try playing some sound.  You may want to check the volume levels again, if you hear sound, it means that your installation isn't auto-detecting your sound card, but you have all of the right software.  We've temporarily loaded the driver, but it will not be installed on the next reboot.
 +
You can override the auto-detection and force your computer to load the driver on every reboot by adding the driver (i.e. snd-via82xx) to the /etc/modules file.  Type <code><nowiki>gksudo gedit /etc/modules</nowiki></code> at the command line, and add your sound driver as the last line of the file.  Save the file, and reboot to verify that the sound is working after a reboot.  Even if this step works, you should file a bug with the Ubuntu developers at http://launchpad.net so they can begin working on it to understand why your computer isn't auto-detecting the soundcard.
 +
=== Refreshing/Reinstalling the drivers ===
 +
Sometimes, sound might be configured correctly, but for some reason or another (tinkering) it stops working.  If this is the case, you can purge your custom changes, and restore your system to a clean base.  This may clear up your problem, and restore you to a working state.
 +
Open a terminal and type <code><nowiki>sudo aptitude --purge reinstall linux-sound-base alsa-base alsa-utils linux-image-`uname -r` linux-ubuntu-modules-`uname -r` libasound2</nowiki></code>.  This will purge any custom configurations that you've made, and any hand-compiled modules that you've built, and restore your sound stack to the "Official" Ubuntu core.  You can also do this as two separate steps: <code><nowiki>sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils</nowiki></code> and then <code><nowiki>sudo apt-get install linux-sound-base alsa-base alsa-utils </nowiki></code>, but this may result in some other packages which depend on the sound-base and alsa-utils from being removed, such as gdm and ubuntu-desktop.  If this happens, then do <code><nowiki>sudo apt-get install gdm ubuntu-desktop</nowiki></code>
 +
=== Another way to restore ALSA to the Ubuntu default ===
 +
I installed alsa from source, and wanted to revert so I wouldn't have to reinstall alsa everytime the kernel moved. The above did not work for me. Here's a safer way that did.
 +
That re-grabs all of the alsa binaries and modules. You may also need to
 +
<code><nowiki>ls -lt /lib/modules/`uname -r`/kernel/sound/</nowiki></code>
 +
And delete anything from the day you manually installed alsa.
 
== ALSA driver Compilation ==
 
== ALSA driver Compilation ==
 
 
*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!
 
*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.
+
*There are two main ways the sources of alsa-drivers are made available to you. One is through 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.
 
*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 ===
 
=== Using alsa-source ===
 
 
Open up a shell: (note: module-assistant is optional, it will compile the package for you)
 
Open up a shell: (note: module-assistant is optional, it will compile the package for you)
 
*Type <code><nowiki>sudo apt-get install build-essential linux-headers-$(uname -r) module-assistant alsa-source</nowiki></code>
 
*Type <code><nowiki>sudo apt-get install build-essential linux-headers-$(uname -r) module-assistant alsa-source</nowiki></code>
第66行: 第181行:
 
*Now you must pick which driver you want to install. Use space to select and deselect modules, and up and down to navigate.
 
*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!
 
*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><nowiki>sudo module-assistant a-i alsa-source</nowiki></code>. 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 chose module-assistant <code><nowiki>sudo module-assistant a-i alsa-source</nowiki></code>. If the progress bar reaches 100% with no errors, you will have installed the drivers successfully. Resume this guide from General Help step 4. You may need to run <code><nowiki>tail -F /var/cache/modass/alsa-source.buildlog.$(uname -r).*</nowiki></code> to see the progress.
*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 did not choose module-assistant - Remember the name of your soundcard driver (eg. via82xx) and use it in place of '''<insert driver>''' below.
<pre><nowiki>cd /usr/src
+
<pre><nowiki>
 +
cd /usr/src
 
sudo tar xjvf alsa-driver.tar.bz2
 
sudo tar xjvf alsa-driver.tar.bz2
cd modules/alsa-driver
+
cd alsa-driver<insert alsa version, if necessary>
sudo ./configure --with-kernel=/usr/src/linux-headers-$(uname -r) --with-cards=<enter driver name here e.g. via82xx> --with-oss=yes
+
sudo ./configure
 
sudo make
 
sudo make
 
sudo make install
 
sudo make install
第78行: 第194行:
 
**''Success'' - Resume this guide from General Help step 4.
 
**''Success'' - Resume this guide from General Help step 4.
 
**''Failure'' - Start a new thread in this thread of the forum. Paste the error message that you get and state that you were following instructions on this page.
 
**''Failure'' - Start a new thread in this thread of the forum. Paste the error message that you get and state that you were following instructions on this page.
 
 
=== Using drivers from alsa-project ===
 
=== Using drivers from alsa-project ===
 
+
'''Update: The instructions below are outdated. Please see http://ubuntuforums.org/showthread.php?t=962695 for a convenient script that will build the latest ALSA release'''
'''update I now recommend using the stable version 1.0.12'''
+
 
+
 
The alsa-project route is very similar to the alsa-source route without the module-assistant.
 
The alsa-project route is very similar to the alsa-source route without the module-assistant.
First you would have to get the alsa-driver tar from alsa-project then pretty much do configure, make and make install again. However, I do recommend that you make a specific directory when you compile something from source. Remember the name of your soundcard driver and use it place of the blue text below.
+
First you would have to get the alsa-driver tar from alsa-project then pretty much do configure, make and make install again. However, I do recommend that you make a specific directory when you compile something from source. Remember the name of your soundcard driver and use it in place of the blue text below.
 
<pre><nowiki>
 
<pre><nowiki>
 
mkdir src
 
mkdir src
第94行: 第207行:
 
tar -xvjf alsa-driver-1.0.12.tar.bz2
 
tar -xvjf alsa-driver-1.0.12.tar.bz2
 
cd alsa-driver-1.0.12
 
cd alsa-driver-1.0.12
sudo ./configure --with-kernel=/usr/src/linux-headers-$(uname -r) --with-cards=<enter driver name here e.g. via82xx> --with-oss=yes
+
sudo ./configure
 
sudo make
 
sudo make
 
sudo make install
 
sudo make install
 
</nowiki></pre>
 
</nowiki></pre>
 
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.
 
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.
 
+
== Having sound issues with HP dvx laptop ==
 +
If you have an HP dv4, dv5, and perhaps a dv7 model series laptop, you may have sound issues. ex: HP Pavilion dv4 1225, HP Pavilion dv5 1044ca, etc...
 +
- this fix work greet with Jaunty Jackalope (Ubuntu 9.04) 30 apr 2009
 +
- the alsa developers have a solution for this issue:
 +
The cause, according to some alsa developers, is an incorrect 'pin' assignment (in the BIOS, perhaps) whereby sound output meant for the internal speakers gets routed to the wrong place.
 +
The latest alsa-driver snapshot provides a fix for this issue. You can get it here:
 +
<pre><nowiki>
 +
cd ~
 +
mkdir src
 +
cd src
 +
mkdir alsa
 +
cd alsa
 +
wget ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
 +
tar -xvpf alsa-driver-snapshot.tar.gz
 +
cd alsa-driver
 +
sudo ./configure
 +
sudo make
 +
sudo make install-modules
 +
</nowiki></pre>
 +
Optional:
 +
<pre><nowiki>
 +
sudo vim /etc/modprobe.d/alsa-base.conf
 +
</nowiki></pre>
 +
[add 'options snd_hda_intel model=hp-dv5' sans quotes to the bottom of the file, even if you have a dv4, etc.]
 +
<pre><nowiki>
 +
sudo reboot
 +
</nowiki></pre>
 +
=== Another possibility for HP dv7 laptops ===
 +
The above procedure did not work for my dv7, but the on-line fix at http://forum.notebookreview.com/showthread.php?t=331172 got things working.
 +
--PeterWhittaker
 +
==== ... which also worked for HP dv4 ====
 +
<pre><nowiki>
 +
options snd-hda-intel enable_msi=1
 +
</nowiki></pre>
 
== Using alsamixer ==
 
== Using alsamixer ==
 
*Type this into a shell <code><nowiki>alsamixer</nowiki></code>
 
*Type this into a shell <code><nowiki>alsamixer</nowiki></code>
第107行: 第253行:
 
**Up and Down Arrow Keys - Increase and decrease volume respectively.
 
**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.
 
**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 Settings ==
 
== Saving Sound Settings ==
 
Do 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><nowiki>sudo alsactl store 0</nowiki></code> 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.
 
Do 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><nowiki>sudo alsactl store 0</nowiki></code> 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.
 +
== Loading a working sound configuration ==
 +
If you can find someone with similar HW as yours and has working sound, you could take their settings and try them on your HW.
 +
<ol><li>Get a working /var/lib/alsa/asound.state from someone who has similar hardware
 +
</li><li>Save it as /tmp/asound.state
 +
</li><li>alsactl -F -f /tmp/asound.state restore</li></ol>
  
 
== Getting more than one application to use the soundcard at the same time ==
 
== Getting more than one application to use the soundcard at the same time ==
第117行: 第267行:
 
*To do this you will need the alsa-oss package <code><nowiki>sudo apt-get install alsa-oss</nowiki></code>
 
*To do this you will need the alsa-oss package <code><nowiki>sudo apt-get install alsa-oss</nowiki></code>
 
*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.
 
*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.
 
 
== Configuring default soundcards / stopping soundcards from switching ==
 
== Configuring default soundcards / stopping soundcards from switching ==
 
 
Note: This section assumes that you have installed each soundcard properly.
 
Note: This section assumes that you have installed each soundcard properly.
 
*In a shell, type <code><nowiki>cat /proc/asound/modules</nowiki></code>
 
*In a shell, type <code><nowiki>cat /proc/asound/modules</nowiki></code>
 
*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.
 
*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><nowiki>sudo nano /etc/modprobe.d/alsa-base</nowiki></code>
+
*Now type <code><nowiki>sudo nano /etc/modprobe.d/alsa-base.conf</nowiki></code>
 
*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)
 
*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)
 
<pre><nowiki>
 
<pre><nowiki>
第130行: 第278行:
 
options snd-B index=2
 
options snd-B index=2
 
</nowiki></pre>
 
</nowiki></pre>
 
+
== Getting ALSA to work after suspend / hibernate ==
 +
Some soundcards does not work after the computer has been suspended or hibernated. Files in ''/etc/pm/sleep.d/'' are read when the system is entering or leaving suspend mode. Create a file telling the system to restart alsa when the computer is being brought up from suspended mode to make the audio work again.
 +
The command ''/sbin/alsa force-reload'' will kill all running programs using the sound driver so the driver itself is able to be restarted.
 +
<pre><nowiki>
 +
sudo nano /etc/pm/sleep.d/50alsa
 +
</nowiki></pre>
 +
<pre><nowiki>
 +
#!/bin/sh
 +
case "$1" in
 +
        hibernate|suspend)
 +
                # Stopping is not required
 +
                ;;
 +
        thaw|resume)
 +
                /sbin/alsa force-reload
 +
                ;;
 +
        *) exit $NA
 +
                ;;
 +
esac
 +
</nowiki></pre>
 +
Make the newly created script to be executable with the following command:
 +
<pre><nowiki>
 +
sudo chmod +x /etc/pm/sleep.d/50alsa
 +
</nowiki></pre>
 
== Getting MIDI To Work - *EXPERIMENTAL* ==
 
== Getting MIDI To Work - *EXPERIMENTAL* ==
 
 
This section assumes you can successfully hear sound from your soundcard.
 
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.
 
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:
 
Next, open up this file:
 
 
<code><nowiki>sudo nano /etc/modprobe.d/alsa-base</nowiki></code>
 
<code><nowiki>sudo nano /etc/modprobe.d/alsa-base</nowiki></code>
 
Then add this options line
 
Then add this options line
 
<code><nowiki>options <snd module name here i.e. snd-via82xx> mpu_port=0x330</nowiki></code>
 
<code><nowiki>options <snd module name here i.e. snd-via82xx> mpu_port=0x330</nowiki></code>
 
OR if you already have a options line for this soundcard add <code><nowiki>mpu_port=0x330</nowiki></code> to the line.
 
OR if you already have a options line for this soundcard add <code><nowiki>mpu_port=0x330</nowiki></code> 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).
 
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.
 
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.
 
+
== Getting Line Input to work (Microphone, etc) ==
 +
=== Changing default subdevice configuration ===
 +
* Some sound devices have multiple capture subdevices (eg. hda-intel), but pulseaudio only seems to detect the parent device, and only listens to subdevice #0. ALSA may not be configured to use your preferred device as subdevice #0 by default.
 +
* Open the pulseaudio record meter (''pavumeter --record'')
 +
* Talk into your chosen device while you carry out the process and watch the meter.
 +
* Some channels are quite noisy even with no input (especially on integrated chipsets), so we are watching for movements that correspond to our voice.
 +
* Use ''alsamixer -c n'' (where n is your sound card number, probably 0)
 +
* Press F4 to get to the capture console
 +
* Make sure the first capture channel is enabled ("CAPTUR" in red, press space to toggle), and the volume turned up.
 +
* Check the first input source is switched to your chosen plug (Mic, in my case)
 +
* At this point, you should see the record meter bouncing in response to your voice.
 +
* I found that I had to repeat this procedure each time I wanted to use the Mic, even though the settings "stuck" in the mixer, something in the soundcard wasn't initialized until it was repeated.
 +
* This also works if you use the "Options" tab in the standard mixer app to do the same thing.
 
== Miscellaneous Tips and Tricks ==
 
== 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).
 
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).
 
 
*shaviro found the following from this post http://www.ubuntuforums.org/showthread.php?t=153752
 
*shaviro found the following from this post http://www.ubuntuforums.org/showthread.php?t=153752
 
 
<code><nowiki>I wasn't getting any sound out of my Sony Vaio PCG-4B1L ...</nowiki></code><code><nowiki>The crucial thing is to enable everything in alsamixer EXCEPT "external amplifier." (I had to turn off microphone too, to stop feedback).</nowiki></code>
 
<code><nowiki>I wasn't getting any sound out of my Sony Vaio PCG-4B1L ...</nowiki></code><code><nowiki>The crucial thing is to enable everything in alsamixer EXCEPT "external amplifier." (I had to turn off microphone too, to stop feedback).</nowiki></code>
 
*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. He and I managed to fix the problem by making sure the main account was in the audio group in /etc/group (which he was) and deleting the .asoundrc file in the main account's /home directory.
 
*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. He and I managed to fix the problem by making sure the main account was in the audio group in /etc/group (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.
 
*Bo Rosén solved his ISA problem the following way. Thanks to FarEast for his help in the matter.
<code><nowiki>Thanks to [[http://ubuntuforums.org/showthread.php?t=127402]] this post I got soundblaster 16 isa working. In short add
+
<code><nowiki>Thanks to [[http://ubuntuforums.org/showthread.php?t=127402]] this post I got soundblaster 16 isa working. In short add{{{snd-sb16{{{ to /etc/modules then create a new file: {{{gedit /etc/modprobe.d/sound</nowiki></code> and enter this line:
<pre><nowiki>snd-sb16{{{ to /etc/modules then create a new file: {{{gedit /etc/modprobe.d/sound</nowiki></code> and enter this line:
+
<pre><nowiki>
<pre><nowiki>options snd-sb16 isapnp=0 port=0x220 irq=5 dma8=1 dma16=5
+
options snd-sb16 isapnp=0 port=0x220 irq=5 dma8=1 dma16=5
sudo update-modules</nowiki></pre> reboot</nowiki></pre>
+
sudo update-modules</nowiki></pre> reboot}}}
 
* webbca01 figured out how to get AC'97 work with the help of the second last post here and this post. Basically, if you have an intel8x0 module, you can get AC'97 working by <code><nowiki>sudo nano /etc/modprobe.d/alsa-base</nowiki></code> and adding this as the last line: <code><nowiki>"options snd-intel8x0 ac97_quirk=3"</nowiki></code>
 
* webbca01 figured out how to get AC'97 work with the help of the second last post here and this post. Basically, if you have an intel8x0 module, you can get AC'97 working by <code><nowiki>sudo nano /etc/modprobe.d/alsa-base</nowiki></code> and adding this as the last line: <code><nowiki>"options snd-intel8x0 ac97_quirk=3"</nowiki></code>
 
+
* scragar noticed that sometimes even if ubuntu is set to use a particular sound card it still attempts to use a default sound card that may or may not be set, in which case <pre><nowiki>
 +
sudo apt-get install asoundconf-gtk && asoundconf-gtk
 +
</nowiki></pre> will allow you to quickly change your default sound card(you may also uninstall asoundconf-gtk afterwards, provided you select remove and not "completely remove", from synaptic, or purge from the command line).
 +
* Sound did not work after resuming from suspend on my Acer Aspire 4720 running Kubuntu Hardy. /etc/init.d/alsa-utils restart (or reset) did not work, neither did any modprobing. Finally, sudo /sbin/alsa force-reload worked.
 +
* Make sure you are part of the audio group. This can be done by issuing the command ''groups''. If you don't see audio here add youself to the audio group.
 +
== If All Else Fails... ==
 +
By default, Ubuntu uses ALSA to communicate with sound hardware and uses PulseAudio as a sound server. If you've followed the troubleshooting guide(s), and still don't have your audio working properly consider replacing ALSA with the [[UbuntuHelp:OpenSound|OpenSound]] System (OSS).
 
== Advanced Guides by other Ubuntuers ==
 
== Advanced Guides by other Ubuntuers ==
 
*[http://www.ubuntuforums.org/showthread.php?p=1269056#post1269056 Soundblaster Audigy 2 AC3 Passthrough] - Howto by dave_euser
 
*[http://www.ubuntuforums.org/showthread.php?p=1269056#post1269056 Soundblaster Audigy 2 AC3 Passthrough] - Howto by dave_euser
 
 
== To Do: ==
 
== To Do: ==
 
=== Important - no particular order ===
 
=== Important - no particular order ===
 
*Getting MIDI to work
 
*Getting MIDI to work
*Compiling alsa entirely (drivers, utils, oss, etc)
+
*Getting line input to work if it does not already - for microphones, etc.
* Getting line input to work if it does not already - for microphones, etc.
+
 
*Getting SPDIF output to work if it does not already - for amplifiers, speakers with digital in.
 
*Getting SPDIF output to work if it does not already - for amplifiers, speakers with digital in.
 
=== On the backburner ===
 
=== On the backburner ===
 
*Scripts for getting configuration that needs to be done in this post to be done automatically
 
*Scripts for getting configuration that needs to be done in this post to be done automatically
 
 
== Related ==
 
== Related ==
 
Getting keyboard multimedia keys to work - [MultimediaKeys]
 
Getting keyboard multimedia keys to work - [MultimediaKeys]
 
 
(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.
 
(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.
 
 
== Posts / References /Credits ==
 
== Posts / References /Credits ==
 
[http://www.ubuntuforums.org/showthread.php?t=21211 Hoary Sound Broke]
 
[http://www.ubuntuforums.org/showthread.php?t=21211 Hoary Sound Broke]
 
 
[http://ubuntuforums.org/showthread.php?t=181186 Problem with Azalia audio]
 
[http://ubuntuforums.org/showthread.php?t=181186 Problem with Azalia audio]
 
 
[http://alsa.opensrc.org/index.php?page=MultipleCards MultipleCards] from alsa.opensrc.org
 
[http://alsa.opensrc.org/index.php?page=MultipleCards MultipleCards] from alsa.opensrc.org
 
 
[http://ubuntuforums.org/showthread.php?t=207107 Volume Control does not save my settings after reboot]
 
[http://ubuntuforums.org/showthread.php?t=207107 Volume Control does not save my settings after reboot]
 
 
Every single sound problem error post I have read
 
Every single sound problem error post I have read
 
 
The Ubuntu community for being energetic, dynamic, and polite providers of help with Ubuntu Linux in all its flavours.
 
The Ubuntu community for being energetic, dynamic, and polite providers of help with Ubuntu Linux in all its flavours.
 +
== Getting support, Reporting Sound Bugs ==
 +
Please do not report problems on this page; use the normal support channels instead.  See http://www.ubuntu.com/support
 +
To find out how to collect relevant information for support or a bug report, see the BugSquad team sound page at https://wiki.ubuntu.com/DebuggingSoundProblems
 
----
 
----
[[category:CategoryCleanup]]
+
[[category:CategoryBugSquad]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月20日 (四) 00:15的最新版本

<<Include(Tag/StyleCleanup)>>

Basic Troubleshooting Steps

Note: Most of these steps apply equally to Ubuntu, Kubuntu and Xubuntu. The core of all of these systems is the same, and sound is a "core" functionality.

Is your volume turned up, or is the speaker muted?

Double click on the "speaker" icon in the upper right hand corner of the screen. This will launch the Volume Control application, which has various sliders to control the volume. Make sure that the speaker, headphone and master sliders are not muted, and have the volume up from zero. On a fresh install of Ubuntu 8.10, the Speaker volume is turned all the way down. You can launch Gnome Volume Control application using Alt+<F2> and type

gnome-volume-control

Re-check the sliders.

Can you play a known-good sound?

aplay is part of the alsaplayer package, and Front_Center.wav is part of the alsa-utils package, so both are pretty standard. So try to run

aplay /usr/share/sounds/alsa/Front_Center.wav

in a terminal. You should hear a voice saying "Front" then "Center". If it doesn't play the first time you run that command, try running it again (it may not play the first time); you can also try running

aplay /usr/share/sounds/alsa/Front_Left.wav
aplay /usr/share/sounds/alsa/Front_Right.wav

Are you in the sound group?

Check that you are in the appropriate group. Depending on your ubuntu version, one of these commands should return something and the other should not:

fgrep -ie 'audio' /etc/group
fgrep -ie 'sound' /etc/group

E.g., with karmic, I got

$ fgrep -ie 'audio' /etc/group
> audio:x:29:pulse
$ fgrep -ie 'sound' /etc/group

so I backed up then changed /etc/group:

$ sudo cp /etc/group /etc/group_TODAYSDATE
$ sudo chmod a-wx /etc/group_TODAYSDATE
$ sudo adduser MY_USERNAME audio
$ fgrep -ie 'audio' /etc/group
> audio:x:29:pulse,MY_USERNAME

Is the system recognizing your sound card?

Open a terminal window, and type

sudo aplay -l

Your output should look something like this:

**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC861VD Analog [ALC861VD Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

If you see aplay: device_list:221: no soundcard found..., Ubuntu is not recognizing your sound card for playback. Check that you have the proper modules installed.

Do you have the sound modules installed?

Open a terminal window, and type

find /lib/modules/`uname -r` | grep snd

You should see a whole list of items come up. If you don't, it means that the upgrade process missed installing the kernel modules for sound. To fix this, type this at the command line:

sudo aptitude install linux-ubuntu-modules-`uname -r` linux-generic

For Ubuntu 9.04 Jaunty Jackalope

sudo aptitude install linux-restricted-modules-`uname -r` linux-generic

After installing the modules, you will need to reboot. If the modules are already installed, proceed to the next step to check to see whether your hardware is recognizing the sound card as installed:

Is the sound card physically installed and recognized by your hardware?

Open a terminal window, and type

lspci -v | less

This will check your computer's motherboard, and attempt to list out all devices that it's recognized as installed. There is probably a lot of things listed, but the one you're looking for will be labeled "Audio device". Mine is listed below:

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
	Subsystem: Toshiba America Info Systems Device ff01
	Flags: bus master, fast devsel, latency 0, IRQ 22
	Memory at dc440000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: <access denied>
	Kernel driver in use: HDA Intel
	Kernel modules: snd-hda-intel

Most users have a "built in" sound card for their computer on the motherboard. If yours is built in, and isn't showing up in this step, then you probably need to enable it in your BIOS. When you first boot, or reboot your computer, there's usually a key sequence telling you how to enter the BIOS Configuration Screen. You'll need to sort through your BIOS and enable the built in sound card. If you are not using a built in sound card, and this step does not show your audio card, the card may be seated incorrectly on your motherboard, or may be bad or otherwise incompatible with your motherboard. You will probably want to test the card in another computer to see if it works there.

Is my SoundCard supported?

The Advanced Linux Sound Architecture (ALSA) is the system that Ubuntu uses for managing Sound output. There is a listing of all of the sound cards supported by ALSA at http://www.alsa-project.org/main/index.php/Matrix:Main . You should look for the information that was listed by lspci in the previous step. If it turns out that your soundcard is not supported by ALSA, you have basically two different options: Get a new soundcard that is supported by ALSA, or contact the ALSA developers to request support for your soundcards. 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. When mentioning module names (to install them or communicate their names to others) only use the dash ' - '.

Is ALSA using the correct model?

If you are experiencing problems with your sound card after upgrading to Ubuntu 9.04, it might be because ALSA is using the wrong model for your chipset. To figure out your chipset you can run this command:

wget -O alsa-info.sh http://alsa-project.org/alsa-info.sh && bash ./alsa-info.sh

This will provide you with a URL to a webpage with lots of information about your sound setup. Open it up, and keep it open; you'll need it as a reference. You can take a look at this webpage as a reference. Now you need to figure out what models are supported by your soundcard. This part is a bit backwards, you have to browse the ALSA git repository. The repository is located at [1], so open up this URL. If you look at the webpage with information about your soundsetup, you'll notice it has a section like this:

!!ALSA Version
!!------------

Driver version:     1.0.18
Library version:    1.0.18
Utilities version:  1.0.18

Notice the driver version. This is the version you should be navigating to in the git repository. If you look at the 'tags' section there's a tag called v1.0.18, which is the one we want. When I navigated into this tag repository, I also had to click the tree link on the top of the page to get a directory listing. Click the Documentation directory, and then click ALSA-Configuration.txt. Remember these links are for the v1.0.18 driver version only, you need to find the appropriate ALSA-Configuration.txt for your driver version. Now you need to figure out what module is loaded by ALSA on your machine. The webpage with all the information about your system comes to the rescue again:

!!Loaded ALSA modules
!!-------------------

snd_hda_intel

You might have to do a bit of digging to find your module in the ALSA-Configuration.txt file. For my module, it is in the section called:

Module snd-hda-intel

Now I have to figured out what Codec my soundcard uses. This is also on the webpage with my sound configuration. It has a section that looks like this:

!!HDA-Intel Codec information
!!---------------------------
--startcollapse--

Codec: SigmaTel STAC9227

Now take a look at ALSA-Configuration.txt again, and you will find a section that looks like this, which matches up with my soundcards codec:

   STAC9227/9228/9229/927x
   ref           Reference board
   3stack        D965 3stack
   5stack        D965 5stack + SPDIF
   dell-3stack   Dell Dimension E520
   dell-bios     Fixes with Dell BIOS setup

A stack is the same as a jack plug in your soundcard. By inspecting your computer you have to figure out how many jacks you have on your soundcard. I have six jacks in the back and two in the front of my computer, so I chose the 5stack model configuration. So armed with this knowledge, it's about time to start configuring your system. This is the steps that were necessary to get a Dell Dimension E520 with Intel HDA and SigmaTel STAC9227 Codec to work after upgrading to Ubuntu 9.04:

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

This part will depend on your soundcard, it consists of the module name (snd-hda-intel) and the model I found in ALSA-Configuration.txt, 5stack:

options snd-hda-intel model=5stack

And finally:

sudo alsa force-reload

Manual Installation

Once you've done the basic troubleshooting listed above, if things still aren't working, you may have found a bug in Ubuntu. It could be something as simple as not detecting your hardware the first time or evidence of a deeper problem. Ubuntu developers need your feedback to see what is not working for you. If you've reached this point, you should file a bug report on http://launchpad.net under the Ubuntu distribution. You should probably include the lspci and aplay output listed above in your bug report. Filing a bug report may seem like a worthless exercise, but it really helps in the development process.

Manually starting the Audio driver

Open a terminal and type sudo modprobe snd-[NAME OF YOUR SOUNDCARD'S DRIVER]. For example, my driver is a via82xx so I would type, sudo modprobe snd-via82xx. After this, try playing some sound. You may want to check the volume levels again, if you hear sound, it means that your installation isn't auto-detecting your sound card, but you have all of the right software. We've temporarily loaded the driver, but it will not be installed on the next reboot. You can override the auto-detection and force your computer to load the driver on every reboot by adding the driver (i.e. snd-via82xx) to the /etc/modules file. Type gksudo gedit /etc/modules at the command line, and add your sound driver as the last line of the file. Save the file, and reboot to verify that the sound is working after a reboot. Even if this step works, you should file a bug with the Ubuntu developers at http://launchpad.net so they can begin working on it to understand why your computer isn't auto-detecting the soundcard.

Refreshing/Reinstalling the drivers

Sometimes, sound might be configured correctly, but for some reason or another (tinkering) it stops working. If this is the case, you can purge your custom changes, and restore your system to a clean base. This may clear up your problem, and restore you to a working state. Open a terminal and type sudo aptitude --purge reinstall linux-sound-base alsa-base alsa-utils linux-image-`uname -r` linux-ubuntu-modules-`uname -r` libasound2. This will purge any custom configurations that you've made, and any hand-compiled modules that you've built, and restore your sound stack to the "Official" Ubuntu core. You can also do this as two separate steps: sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils and then sudo apt-get install linux-sound-base alsa-base alsa-utils , but this may result in some other packages which depend on the sound-base and alsa-utils from being removed, such as gdm and ubuntu-desktop. If this happens, then do sudo apt-get install gdm ubuntu-desktop

Another way to restore ALSA to the Ubuntu default

I installed alsa from source, and wanted to revert so I wouldn't have to reinstall alsa everytime the kernel moved. The above did not work for me. Here's a safer way that did. That re-grabs all of the alsa binaries and modules. You may also need to ls -lt /lib/modules/`uname -r`/kernel/sound/ And delete anything from the day you manually installed alsa.

ALSA driver Compilation

  • 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 through 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

Open up a shell: (note: module-assistant is optional, it will compile the package for you)

  • Type sudo apt-get install build-essential linux-headers-$(uname -r) module-assistant alsa-source
  • Type sudo dpkg-reconfigure alsa-source
  • 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 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. You may need to run tail -F /var/cache/modass/alsa-source.buildlog.$(uname -r).* to see the progress.
  • If you did not choose module-assistant - Remember the name of your soundcard driver (eg. via82xx) and use it in place of <insert driver> below.
cd /usr/src
sudo tar xjvf alsa-driver.tar.bz2
cd alsa-driver<insert alsa version, if necessary>
sudo ./configure
sudo make
sudo make install
  • If you get no error messages, you will have installed the drivers successfully.
    • Success - Resume this guide from General Help step 4.
    • Failure - Start a new thread in this thread of the forum. Paste the error message that you get and state that you were following instructions on this page.

Using drivers from alsa-project

Update: The instructions below are outdated. Please see http://ubuntuforums.org/showthread.php?t=962695 for a convenient script that will build the latest ALSA release The alsa-project route is very similar to the alsa-source route without the module-assistant. First you would have to get the alsa-driver tar from alsa-project then pretty much do configure, make and make install again. However, I do recommend that you make a specific directory when you compile something from source. Remember the name of your soundcard driver and use it in place of the blue text below.

mkdir src
cd src
mkdir alsa
cd alsa
sudo apt-get install build-essential linux-headers-$(uname -r)
wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.12.tar.bz2
tar -xvjf alsa-driver-1.0.12.tar.bz2
cd alsa-driver-1.0.12
sudo ./configure
sudo make
sudo make install

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.

Having sound issues with HP dvx laptop

If you have an HP dv4, dv5, and perhaps a dv7 model series laptop, you may have sound issues. ex: HP Pavilion dv4 1225, HP Pavilion dv5 1044ca, etc... - this fix work greet with Jaunty Jackalope (Ubuntu 9.04) 30 apr 2009 - the alsa developers have a solution for this issue: The cause, according to some alsa developers, is an incorrect 'pin' assignment (in the BIOS, perhaps) whereby sound output meant for the internal speakers gets routed to the wrong place. The latest alsa-driver snapshot provides a fix for this issue. You can get it here:

cd ~
mkdir src
cd src
mkdir alsa
cd alsa
wget ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
tar -xvpf alsa-driver-snapshot.tar.gz
cd alsa-driver
sudo ./configure
sudo make
sudo make install-modules

Optional:

sudo vim /etc/modprobe.d/alsa-base.conf

[add 'options snd_hda_intel model=hp-dv5' sans quotes to the bottom of the file, even if you have a dv4, etc.]

sudo reboot

Another possibility for HP dv7 laptops

The above procedure did not work for my dv7, but the on-line fix at http://forum.notebookreview.com/showthread.php?t=331172 got things working. --PeterWhittaker

... which also worked for HP dv4

options snd-hda-intel enable_msi=1

Using alsamixer

  • Type this into a shell 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 Settings

Do 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 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.

Loading a working sound configuration

If you can find someone with similar HW as yours and has working sound, you could take their settings and try them on your HW.

  1. Get a working /var/lib/alsa/asound.state from someone who has similar hardware
  2. Save it as /tmp/asound.state
  3. alsactl -F -f /tmp/asound.state restore

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 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.

Configuring default soundcards / stopping soundcards from switching

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

  • In a shell, type 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 sudo nano /etc/modprobe.d/alsa-base.conf
  • 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)
options snd-C index=0
options snd-A index=1
options snd-B index=2

Getting ALSA to work after suspend / hibernate

Some soundcards does not work after the computer has been suspended or hibernated. Files in /etc/pm/sleep.d/ are read when the system is entering or leaving suspend mode. Create a file telling the system to restart alsa when the computer is being brought up from suspended mode to make the audio work again. The command /sbin/alsa force-reload will kill all running programs using the sound driver so the driver itself is able to be restarted.

sudo nano /etc/pm/sleep.d/50alsa
#!/bin/sh
case "$1" in
        hibernate|suspend)
                # Stopping is not required
                ;;
        thaw|resume)
                /sbin/alsa force-reload
                ;;
        *) exit $NA
                ;;
esac

Make the newly created script to be executable with the following command:

sudo chmod +x /etc/pm/sleep.d/50alsa

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: sudo nano /etc/modprobe.d/alsa-base Then add this options line options <snd module name here i.e. snd-via82xx> mpu_port=0x330 OR if you already have a options line for this soundcard add 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.

Getting Line Input to work (Microphone, etc)

Changing default subdevice configuration

  • Some sound devices have multiple capture subdevices (eg. hda-intel), but pulseaudio only seems to detect the parent device, and only listens to subdevice #0. ALSA may not be configured to use your preferred device as subdevice #0 by default.
  • Open the pulseaudio record meter (pavumeter --record)
  • Talk into your chosen device while you carry out the process and watch the meter.
  • Some channels are quite noisy even with no input (especially on integrated chipsets), so we are watching for movements that correspond to our voice.
  • Use alsamixer -c n (where n is your sound card number, probably 0)
  • Press F4 to get to the capture console
  • Make sure the first capture channel is enabled ("CAPTUR" in red, press space to toggle), and the volume turned up.
  • Check the first input source is switched to your chosen plug (Mic, in my case)
  • At this point, you should see the record meter bouncing in response to your voice.
  • I found that I had to repeat this procedure each time I wanted to use the Mic, even though the settings "stuck" in the mixer, something in the soundcard wasn't initialized until it was repeated.
  • This also works if you use the "Options" tab in the standard mixer app to do the same thing.

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).

I wasn't getting any sound out of my Sony Vaio PCG-4B1L ...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. He and I managed to fix the problem by making sure the main account was in the audio group in /etc/group (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.

Thanks to [[http://ubuntuforums.org/showthread.php?t=127402]] this post I got soundblaster 16 isa working. In short add{{{snd-sb16{{{ to /etc/modules then create a new file: {{{gedit /etc/modprobe.d/sound and enter this line:

options snd-sb16 isapnp=0 port=0x220 irq=5 dma8=1 dma16=5
sudo update-modules
reboot}}}
  • webbca01 figured out how to get AC'97 work with the help of the second last post here and this post. Basically, if you have an intel8x0 module, you can get AC'97 working by sudo nano /etc/modprobe.d/alsa-base and adding this as the last line: "options snd-intel8x0 ac97_quirk=3"
  • scragar noticed that sometimes even if ubuntu is set to use a particular sound card it still attempts to use a default sound card that may or may not be set, in which case
sudo apt-get install asoundconf-gtk && asoundconf-gtk will allow you to quickly change your default sound card(you may also uninstall asoundconf-gtk afterwards, provided you select remove and not "completely remove", from synaptic, or purge from the command line).
  • Sound did not work after resuming from suspend on my Acer Aspire 4720 running Kubuntu Hardy. /etc/init.d/alsa-utils restart (or reset) did not work, neither did any modprobing. Finally, sudo /sbin/alsa force-reload worked.
  • Make sure you are part of the audio group. This can be done by issuing the command groups. If you don't see audio here add youself to the audio group.

If All Else Fails...

By default, Ubuntu uses ALSA to communicate with sound hardware and uses PulseAudio as a sound server. If you've followed the troubleshooting guide(s), and still don't have your audio working properly consider replacing ALSA with the OpenSound System (OSS).

Advanced Guides by other Ubuntuers

To Do:

Important - no particular order

  • Getting MIDI to work
  • Getting line input to work if it does not already - for microphones, etc.
  • Getting SPDIF output to work if it does not already - for amplifiers, speakers with digital in.

On the backburner

  • Scripts for getting configuration that needs to be done in this post to be done automatically

Related

Getting keyboard multimedia keys to work - [MultimediaKeys] (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.

Posts / References /Credits

Hoary Sound Broke Problem with Azalia audio MultipleCards from alsa.opensrc.org Volume Control does not save my settings after reboot Every single sound problem error post I have read The Ubuntu community for being energetic, dynamic, and polite providers of help with Ubuntu Linux in all its flavours.

Getting support, Reporting Sound Bugs

Please do not report problems on this page; use the normal support channels instead. See http://www.ubuntu.com/support To find out how to collect relevant information for support or a bug report, see the BugSquad team sound page at https://wiki.ubuntu.com/DebuggingSoundProblems