Difference between revisions of "Advanced Linux Sound Architecture (Português)"

From ArchWiki
Jump to: navigation, search
(Common Problems)
Line 1: Line 1:
 +
[[Category:Audio/Video]][[Category:Installation]]
 
{{i18n_links_start}}
 
{{i18n_links_start}}
 
{{i18n_entry|English|ALSA Setup}}
 
{{i18n_entry|English|ALSA Setup}}
Line 10: Line 11:
 
{{i18n_links_end}}
 
{{i18n_links_end}}
  
=Questões Comuns=
+
This document tells how to get Alsa working with both the 2.4 and 2.6 kernels. Also see how to
==O que é o AUR ?==
+
[[Allow_multiple_programs_to_play_sound_at_once|allow multiple programs to play sound at once]].
AUR (Arch User Repository - Repositório do Usuário Arch) é um local para onde a comunidade Archlinux pode enviar 
+
PKGBUILDs de aplicações, bibliotecas, etc e compartilhá-los entre todos os seus membros. Outros usuários podem votar pelos seus favoritos para que entrem para o repositório Community (Comunidade), para serem compartilhados entre os usuários Archlinux em formato binário.
+
  
==O que é um TU?==
+
==Installation==
Um TU (Trusted User - Usuário de Confiança) é uma pessoa que é escolhida para zelar pelos repositórios AUR e Community (Comunidade). Eles são os que colocam os PKGBUILDs mais votados no repositório Community (Comunidade), marcam PKGBUILDs como seguros e sobretudo mantém o AUR funcionando.
+
Qual a diferença entre Unsupported (Não suportado) e Community (Comunidade)?
+
Unsupported (Não suportado) é onde ficam todos os PKGBUILDs que os usuários enviam, eles devem ser montados manualmente com makepkg.
+
Os PKGBUILDs que obtém votos suficientes vão para o repositório Community (Comunidade), onde os TUs os mantém e de onde podem ser instalados através do pacman, uma vez que eles agora são pacotes binários.
+
  
Quantos votos são necessários para levar um PKGBUILD para o Community (Comunidade)?
+
===Kernel drivers===
Normalmente são precisos 25 votos para algo ir para o Community (Comunidade). Uma exceção a isso é se uma aplicação é desenvolvida no Archlinux e um TU deseja colocá-lo diretamente nesse repositório.
+
  
==Onde eu obtenho informação sobre como criar um PKGBUILD?==
+
====2.4 kernels====
O melhor local para se obter essa informação é nesta entrada do wiki. Lembre-se de verificar o AUR antes de criar o PKGBUILD de maneira a não duplicar esforços.
+
  
=Problemas Comuns=
+
If you use a 2.4 kernel, you will have to install the alsa drivers. If you use the stock arch '''kernel24''' or '''kernel24-scsi''' package, you can use the '''alsa-driver''' package:
Eu tento usar pacman -S foo e não funciona, mas eu sei que ele está em Community (Comunidade).
+
 
Provavelmente Community não está habilitado no seu /etc/pacman.conf. Simplesmente descomente as linhas correspondentes.
+
# pacman -Sy alsa-driver
==Foo, no AUR está desatualizado, o que eu faço?==
+
# depmod -a
Para começar você deve marcá-lo como out-to-date (desatualizado). Se ele continuar desatualizado por um tempo considerável, a melhor coisa a fazer é enviar um email ao mantenedor do pacote. Se não receber resposta do mantenedor você pode solicitar a um TU que coloque o PKGBUILD como órfão (orphan), se estiver disposto a mantê-lo você mesmo.
+
 
==Eu tenho um PKGBUILD que gostaria de submeter, alguém poderia verificá-lo para ver se há algum erro?==
+
If you compiled your own 2.4 kernel, these will not work, and you should compile a new 'alsa-driver' package with ABS while running your custom kernel, and install the resulting package instead.
Se você gostaria de ter seu PKGBUILD comentado, poste-o na Lista de Email do AUR para obter retorno dos TUs e membros do AUR.
+
 
Você pode também obter ajuda da turma do canal irc: irc.freenode.net #archlinux
+
====2.6 kernels====
==Foo, no AUR, não compila quando uso-o com makepkg, o que devo fazer?==
+
 
Bem, primeiramente certifique-se de fazer um pacman -Syu antes de compilar qualquer coisa com makepkg já que o problema pode ser que seu sistema não esteja atualizado.
+
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.
Se não for isso reporte o problema ao mantenedor.
+
 
 +
'''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.
 +
 
 +
 
 +
 
 +
==Configuration==
 +
 
 +
===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:
 +
 
 +
* Locate the module for your soundcard: http://www.alsa-project.org/alsa-doc/  The module will be prefixed with 'snd-' (for example: 'snd-via82xx').
 +
* Load modules:
 +
  # 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'<br>
 +
'''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
 +
 
 +
* [[Allow multiple programs to play sound at once]]
 +
 
 +
===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 <code>/etc/modprobe.conf</code> fixes this problem (with the <code>via82xx</code> 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
 +
 
 +
* <b>KDE 3.3</b> 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.

Revision as of 02:26, 16 June 2006

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

This document tells how to get Alsa working with both the 2.4 and 2.6 kernels. Also see how to allow multiple programs to play sound at once.

Installation

Kernel drivers

2.4 kernels

If you use a 2.4 kernel, you will have to install the alsa drivers. If you use the stock arch kernel24 or kernel24-scsi package, you can use the alsa-driver package:

# pacman -Sy alsa-driver
# depmod -a

If you compiled your own 2.4 kernel, these will not work, and you should compile a new 'alsa-driver' package with ABS while running your custom kernel, and install the resulting package instead.

2.6 kernels

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.


Configuration

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.