Difference between revisions of "ALSA"

From SlackWiki
Jump to: navigation, search
(Copy from old)
 
(Modernization)
Line 1: Line 1:
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
==Non-USB Cards==
 
I'm sure that everyone has had their share of audio problems in Slackware, Well I'm going to try and get that audio working for you. First you want to know what kind of sound card you have, usually PCI so type this in:
 
  
: <code>/sbin/lspci</code>
+
Sound problems *should* be rare these days, and of the ones that still exist, they are likely related to suspend/resume.  Those are driver issues which are largely out of your control, but see the documentation with the pm-utils package for details on handling those issues.
  
This will let you know the audio card you have, now that you have it written down we are going to run a program to configure your card:
+
: <code>alsaconf</code> used to be needed to set up sound cards in linux, but even that shouldn't be needed in recent linux distributions - everything should be handled automatically.
  
: <code>/usr/sbin/alsaconf</code>
+
: <code>alsamixer</code> can be used to change the volume.
  
This will configure your sound and hopefully detect it. Well there are many reasons of why it wouldn't have detected your card, so I'm just going to make a list for you:
+
: <code>alsactl store</code> is used to save the volume settings.
  
# alsa-driver's package isn't compiled for the kernel you are running.
+
: <code>alsactl restore</code> is used to restore the volume settings. This is automatically run on boot, so you usually won't need to run this command.
# If you don't have alsa-drivers package, then your 2.6 kernel (hopefully because 2.4 doesn't have built in drivers for alsa) doesn't have the drivers compiled in.
 
# Your modules are screwed up :)
 
  
==All Cards==
+
There is one tip for the Sound Baster 5.1 cards: sometimes you want to MUTE digital out so you can hear on all the speakers; in alsamixer, you just press M on the <tt>Analog/Digital Output Jack</tt> item.
 
 
Now that we have all of that together, try to play an MP3 sound file as root:
 
 
 
: <code>mpg321 file.mp3</code>
 
 
 
Now if that plays you are good to go, but if it doesn't then you might want to check on the things above. If it doesn't work then you type this in:
 
 
 
: <code>cat /proc/asound/cards</code>
 
 
 
Now this will show all the cards that alsa has loaded modules for and what alsa detected. Now with one driver you will see a modem occupying sound device 0. We do not want that because it will conflict. The module for the sound card is snd-intel8x0. Now we need to add the module for the modem to the blacklist:
 
 
 
: <code>echo "snd-intel8x0m" >> /etc/hotplug/blacklist</code>
 
 
 
Now make sure you use two >'s because if you use only 1, it will overwrite the file and we do not want that. Now restart your machine and you will now have a non conflicting sound module for the intel 8x0 cards. Now we also want to change permissions:
 
 
 
: <code>chmod 666 /dev/dsp*</code>
 
: <code>chmod 666 /dev/snd/*</code>
 
 
 
Now this will make sure OSS and ALSA have permission for everyone to access the sound devices, Now in slackware 10 you just add yourself to the audio group, but Slackware 9.1 doesn't have that option. Now say you want to change the volume levels?
 
 
 
: <code>alsamixer</code>
 
 
 
When you type that you will get an ncurses based mixer program:) This is great for changing volumes and muting certain things. Per default all channels are muted (alsaconf will unmute a few though). You can unmute them with M. Channels that you should watch are PCM and Master. Those often control the sound level.
 
Now say you have the sound mixers perfect and you want to save them:
 
 
 
: <code>alsactl store</code>
 
 
 
This stores the config and is restored at bootup. You can also restore later on if you screw them up to by typing the following:
 
 
 
: <code>alsactl restore</code>
 
 
 
There is one tip for the Sound Baster 5.1 cards, sometimes you want to MUTE digital out so you can hear on all the speakers, in alsamixer you just press M on the <tt>Analog/Digital Output Jack</tt> item.
 

Revision as of 14:18, 6 October 2010


Sound problems *should* be rare these days, and of the ones that still exist, they are likely related to suspend/resume. Those are driver issues which are largely out of your control, but see the documentation with the pm-utils package for details on handling those issues.

alsaconf used to be needed to set up sound cards in linux, but even that shouldn't be needed in recent linux distributions - everything should be handled automatically.
alsamixer can be used to change the volume.
alsactl store is used to save the volume settings.
alsactl restore is used to restore the volume settings. This is automatically run on boot, so you usually won't need to run this command.

There is one tip for the Sound Baster 5.1 cards: sometimes you want to MUTE digital out so you can hear on all the speakers; in alsamixer, you just press M on the Analog/Digital Output Jack item.