Linux声卡问题通用解决方法

如果你的声卡不出声而找不到原因,请按着本文的顺序走一遍也许就能解决了 。(以ubuntu为例,原文在 http://ubuntuforums.org/showthread.php?t=205449)

(1)在shell下输入命令:

aplay -l

(2) 在shell下输入命令:

lspci -v

(3) 检查你的声卡相对应的ALSA驱动是否存在。请访问 http://www.alsa-project.org/alsa-doc/ 在下拉菜单中搜索你的声卡(芯片)或者厂商名。 你能会看到一个声卡厂商列表。看看是不是能找到第二步列出信息对应的芯片。

(4) 现在回到shell1,输入命令:

sudo modprobe snd-

现在,在敲回车键前按下TAB键,系统将列出一堆模块。试着找到匹配你在第三步找到的设备的驱动的模块。

例如,我的驱动是 via82xx ,因此我将输入 sudo modprobe snd-via82xx.

通过更新内核得到 ALSA 驱动支持

有时,声音设置可能在最开始得到正确的配置,但由于这样或那样的原因不工作了。一种恢复旧的可用配置的方式就是重新安装 Ubuntu。 但这样因为某个软件的缺陷重做全部的系统一点儿必要也没有。

另一个更快的解决方案就是,删除问题软件并重新安装正确的版本。

ALSA driver Compilation

Using alsa-source

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

    sudo apt-get install build-essential linux-headers-$(uname -r) module-assistant alsa-source
    sudo dpkg-reconfigure alsa-source
  2. 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).
  3. Now you must pick which driver you want to install. Use space to select and deselect modules, and up and down to navigate.
  4. 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.
    • If you did not choose module-assistant - Remember the name of your soundcard driver and use it place of the blue text below.

      cd /usr/src
      sudo tar xjvf alsa-driver.tar.bz2
      cd modules/alsa-driver
      sudo ./configure  --with-kernel=/usr/src/linux-headers-$(uname -r) --with-cards=<enter driver name here e.g. via82xx> --with-oss=yes
      sudo make
      sudo make install

If you get no error messages, you will have installed the drivers successfully.

Using drivers from alsa-project - update I now recommend using the stable version 1.0.12

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

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

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

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

Configuring default soundcards / stopping multiple soundcards from switching

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

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

grep 'audio' /etc/group

You should see a line similar to

audio:x:29:

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

audio:x:29:ubuntu

If you see something else i.e.

audio:x:29:root

you should add your username to the file by doing

sudo nano /etc/group

Now find the line that looks like

audio:x:29:root

and change it to

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:

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.

小帖士

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

对于 Ubuntu 用户的一些高级指南

更多资料

http://www.sabi.co.uk/Notes/linuxSoundALSA.html - Some advanced reading on ALSA - thanks segalion

  1. 适用于配置了 bash-complete 的 Bash,多数 Ubuntu 和 Debian 系统默认配置就可以满足此要求 (1)

  2. Thanks to rustybutt for this simple check. (2)

None: ComprehensiveSoundProblemSolutions (last edited 2008-10-04 14:23:55 by FKtPp)