Advanced Linux Sound Architecture (Português)

From ArchWiki
Revision as of 22:03, 27 August 2006 by Nozey (talk | contribs) (Kernel 2.4 translated)
Jump to navigation Jump to search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Advanced Linux Sound Architecture (Português)#)

Este documento mostra como configurar o alsa tanto com a série 2.4 do kernel, quanto com a 2.6. Veja, também, como permitir que os programas toquem som ao mesmo tempo


Kernel drivers

Kernel 2.4

Se você usa um kernel da série 2.4, você terá que instalar os drivers do alsa. Se o seu kernel foi instalado com o pacote pré-compilado kernel24 ou kernel24-scsi, você pode usar o pacote alsa-driver:

# pacman -Sy alsa-driver
# depmod -a

Se você compilou o seu próprio kernel, você deve compilar um novo pacote do 'alsa-driver' com o ABS e instalá-lo.

Kernel 2.6

Alsa has been included in the 2.6 kernels and is included in all arch kernel26* packages. If you build a custom kernel, do not forget to enable the correct alsa driver.

NOTE ON UDEV AUTODETECTION: Old arch installations or new installations from the 0.7.1 CD (recent FTP installations are not affected) will have an old default setting in /etc/modprobe.conf that WILL BREAK SOUND AUTODETECTION. If your sound modules are not loaded automatically after installation or udev update, please REMOVE THESE LINES FROM /etc/modprobe.conf:

# OSS Compatibility
install snd-pcm modprobe -i snd-pcm ; modprobe snd-pcm-oss ; true
install snd-seq modprobe -i snd-seq ; modprobe snd-seq-oss ; true

After REMOVING these, sound should be autodetected properly on (re)boot. Also NEVER use alsaconf if you have a PCI or ISAPNP sound card, the entries alsaconf adds to the modprobe.conf file might have a similar effect on udev's autodetection.

Userspace utilities

  • Required for native alsa programs and administration
# pacman -Sy alsa-lib alsa-utils
  • Recommended if you want to use applications with OSS sound support in combination with dmix:
# pacman -S alsa-oss

All alsa programs will most likely have alsa-lib as a dependency.


Making sure the sound modules are loaded

You can assume that udev (or hotplug for 2.4 kernels) will autodetect your sound properly, including the OSS compatibility modules. You can check this with the command

$ lsmod|grep ^snd
snd_usb_audio          69696  0 
snd_usb_lib            13504  1 snd_usb_audio
snd_rawmidi            20064  1 snd_usb_lib
snd_hwdep               7044  1 snd_usb_audio
snd_seq_oss            29412  0 
snd_seq_midi_event      6080  1 snd_seq_oss
snd_seq                46220  4 snd_seq_oss,snd_seq_midi_event
snd_seq_device          6796  3 snd_rawmidi,snd_seq_oss,snd_seq
snd_pcm_oss            45216  0 
snd_mixer_oss          15232  1 snd_pcm_oss
snd_intel8x0           27932  0 
snd_ac97_codec         87648  1 snd_intel8x0
snd_ac97_bus            1792  1 snd_ac97_codec
snd_pcm                76296  4 snd_usb_audio,snd_pcm_oss,snd_intel8x0,snd_ac97_codec
snd_timer              19780  2 snd_seq,snd_pcm
snd                    43776  12 snd_usb_audio,snd_rawmidi,snd_hwdep,snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer
snd_page_alloc          7944  2 snd_intel8x0,snd_pcm

If the output looks similar, your sound drivers have been successfully autodetected (note that in this case, snd_intel8x0 and snd_usb_audio are the drivers for the hardware devices). You might also want to check the directory /dev/snd for the right device files (kernel 2.6 and udev only):

$ ls -l /dev/snd/
total 0
crw-rw----  1 root audio 116,  0 Apr  8 14:17 controlC0
crw-rw----  1 root audio 116, 32 Apr  8 14:17 controlC1
crw-rw----  1 root audio 116, 24 Apr  8 14:17 pcmC0D0c
crw-rw----  1 root audio 116, 16 Apr  8 14:17 pcmC0D0p
crw-rw----  1 root audio 116, 25 Apr  8 14:17 pcmC0D1c
crw-rw----  1 root audio 116, 56 Apr  8 14:17 pcmC1D0c
crw-rw----  1 root audio 116, 48 Apr  8 14:17 pcmC1D0p
crw-rw----  1 root audio 116,  1 Apr  8 14:17 seq
crw-rw----  1 root audio 116, 33 Apr  8 14:17 timer

If you have at least the devices controlC0 and pcmC0D0p or similar, then your sound modules have been detected and loaded properly.

If this is not the case, you will have to load the modules manually:

 # modprobe snd-NAME-OF-MODULE
 # modprobe snd-pcm-oss
  • Check for the device files in /dev/snd (see above) and/or try if alsamixer or amixer have resonable output.
  • Add snd-pcm-oss and snd-NAME-OF-MODULE to the list of MODULES in /etc/rc.conf to ensure they are loaded next time.

Unmuting the channels and testing the sound card

  • Unmute Soundcard
 # amixer set Master 75 unmute
 # amixer set PCM 75 unmute

You can alsa do this graphically using 'alsamixer'
NOTE: When using alsamixer, be sure to unmute (push M) as well as bring volumes up.

  • Try to play a wave file
 # aplay mywav.wav

Setup Permissions

To be able to use the sound card as a user, follow these steps:

  • Add your user to the audio group:
# gpasswd -a USERNAME audio
  • Log your user out and back in to ensure the audio group is loaded.

Restore Alsa Mixer settings at Startup

  • Run 'alsactl' once to create '/etc/asound.state'
alsactl store
  • Edit '/etc/rc.conf' and add 'alsa' to the list of daemons to start on bootup. This will store the mixer settings on every shutdown and restore them when you boot.

Getting SPDIF output

(from gralves from the gentoo forums)

  • In Gnome Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.
  • If you don't have Gnome Volume Control installed,
    • Edit /etc/asound.state. This file is where alsasound store your mixer settings.
    • Find a line that says : 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true
    • Now find this line: 'IEC958 Playback AC97-SPSA' and change value to 0.
    • Restart alsa.

Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):

  • add following lines to /etc/rc.local:
 # Use COAX-digital output
 amixer set 'IEC958 Optical' 100 unmute
 amixer set 'Audigy Analog/Digital Output Jack' on

You can see the name of your cards digital output name with:

 amixer scontrols

Still Getting No Sound?

Even though your drivers are installed correctly, and your volume is right, and nothing is muted, you might not hear anything! Adding the following line to /etc/modprobe.conf fixes this problem (with the via82xx driver, at least).

options snd-NAME-OF-MODULE ac97_quirk=0

KDE settings

  • Start up KDE:
# startx
  • Setup the volumes as you want them for this user (each user has their own settings):
# alsamixer
  • KDE 3.3 Go to the K Menu > Multimedia > KMix
    • Choose Settings > Configure KMix...
    • Un-check the option "Restore volumes on logon"
    • Press OK, and you should be all set. Now your volumes will be the same from the command line or within KDE.