Differences between revisions 61 and 62
Revision 61 as of 2005-02-11 20:54:46
Size: 6595
Editor: anonymous
Comment:
Revision 62 as of 2005-02-11 21:04:23
Size: 5859
Editor: anonymous
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
["ALSA"] is not just a set of ["sound"] drivers, it is also a library with an extensible ["API"] that gives applications access to the latest features of sound cards (e.g., multiple sound channels, Dolby [["AC3"]], etc.). ALSA provides efficient support for all types of audio interfaces (i.e. ["XMMS"]), is fully modularized, is [http://en.wikipedia.org/wiki/Symmetric_multiprocessing wiki:Self:SMP] and thread-safe and provides a high-quality user space library called alsa-lib to simplify application programming. ["ALSA"] is not just a set of ["sound"] drivers; it is also a library with an extensible ["API"] that gives applications access to the latest features of sound cards (e.g., multiple sound channels, Dolby [["AC3"]], etc.). ALSA provides efficient support for many applications (e.g., ["XMMS"]), is fully modularized, is [http://en.wikipedia.org/wiki/Symmetric_multiprocessing wiki:Self:SMP] and thread-safe.
Line 11: Line 11:
Line 13: Line 14:
 * libasound2
Line 14: Line 16:
 * alsa-xmms
Line 19: Line 20:
The easiest and automatical way to detect your linux sound and to arrange for it to be automatically loaded when the snd module is loaded is to use ["alsaconf"]. It modifies /etc/modutils/sound or /etc/modprobe.d/sound, depending on whether you are running Linux 2.4 or 2.6, respectively. The easiest way to detect your linux sound and to arrange for it to be automatically loaded when the snd module is loaded is to use ["alsaconf"]. It modifies /etc/modutils/sound or /etc/modprobe.d/sound, depending on whether you are running Linux 2.4 or 2.6, respectively.
Line 31: Line 32:
If your card was automatically configured to work under Debian with the ["OSS"] Free sound drivers, then look at your current /etc/modules.conf file. There will be an entry for the OSS Free module that will also give you a clue of the chipset involved. If your card was automatically configured to work under Debian with the ["OSS"] sound drivers, then look at your current /etc/modules.conf file. There will be an entry for the OSS module that will also give you a clue of the chipset involved.
Line 35: Line 36:
If you don't unload the Oss modules, them the alsa driver will not be able to start because the oss driver will be using the hardware resources associated with your soundcard. If you see a message about "sound card not detected" and you are sure you have the right alsa driver, this is probably the reason. If you don't unload the OSS modules, them the ALSA driver will not be able to start because the OSS driver will be using the hardware resources associated with your soundcard. If you see a message about "sound card not detected" and you are sure you have the right ALSA driver, this is probably the reason.
Line 39: Line 40:
== Starting and stopping alsasound ==
For this you can use '''/etc/rc.d/init.d/alsasound'''

/etc/rc.d/init.d/alsasound* start

begins ALSA.

If everything is fine you should see the familiar OK startup aknowledgements from the script and the sound driver kernel modules should load.

'''/etc/rc.d/init.d/alsasound stop'''

stops the ALSA drivers.

== Mixer Configuration ==
If the modules loaded successfully it is time to configure the AlsaMixer (provided your soundcard has one).
Line 57: Line 42:
{{{
 aplay -device="plughw" soundfile.wav
}}}
Line 61: Line 43:
["aplay"] is an example program and only understands .wav files so it will not be able to play any other format.  ["aplay"] only understands .wav files.
Line 68: Line 50:
ALSA loads sound 'cards' in the order it finds them. The first card is always used as the 'default'. If you're unlucky, and a microphone gets selected first, then you're not going to be able to play sounds. You can check the order that ALSA has loaded card with: The first card that ALSA finds is usually given index 0 and thus is usually the 'default' sound card. If you are unlucky then the first sound card found is one that it not suitable for playing system sounds

You can see what indexes have been assigned to cards by running:

["Sound"]


["ALSA"], the Advanced Linux Sound Architecture, was originally started because the OSS architecture (see ["OSSFree"]) was outdated and the free variant of OSS lacked some drivers available only in the commercial variant. For several years ["ALSA"] was a project separate from Linux. The drivers were added to Linux during the 2.5 development series and became the standard sound driver system in Linux 2.6.

Alsa driver names always start with snd-

["ALSA"] is not just a set of ["sound"] drivers; it is also a library with an extensible ["API"] that gives applications access to the latest features of sound cards (e.g., multiple sound channels, Dolby ?"AC3", etc.). ALSA provides efficient support for many applications (e.g., ["XMMS"]), is fully modularized, is [http://en.wikipedia.org/wiki/Symmetric_multiprocessing wiki:?SMP] and thread-safe.

ALSA is backwards compatible with ["OSS"] (OSS Emulation ), but you cannot use Alsa and OSS kernel device drivers at the same time (see the ALSA-OSS section above).

Packages

  • alsa-base
  • libasound2
  • alsa-utils
  • alsa-oss
  • alsamixergui

Alsaconf

The easiest way to detect your linux sound and to arrange for it to be automatically loaded when the snd module is loaded is to use ["alsaconf"]. It modifies /etc/modutils/sound or /etc/modprobe.d/sound, depending on whether you are running Linux 2.4 or 2.6, respectively.

Find out which sound chipset your soundcard is using

You can try to detect and configure your sound card manually.

  • If you have a PCI soundcard, do an '["lspci"] -v' to list all available pci devices. The list will most probably include a reference to a multimedia audio device: that is your SoundCard.

  • If you use a ISA PNP card, utilize the command ["pnpdump"]
  • For a ["USB"] card, use ["hotplug"].

You could now have a look at the [http://www.alsa-project.org/alsa-doc/ ALSA soundcard matrix] to find out which driver name can be used for the chipset you found.

ALSA and OSS

If your card was automatically configured to work under Debian with the ["OSS"] sound drivers, then look at your current /etc/modules.conf file. There will be an entry for the OSS module that will also give you a clue of the chipset involved.

Don't forget to disable any lines in /etc/modules.conf that correspond to the oss sound driver kernel modules.

If you don't unload the OSS modules, them the ALSA driver will not be able to start because the OSS driver will be using the hardware resources associated with your soundcard. If you see a message about "sound card not detected" and you are sure you have the right ALSA driver, this is probably the reason.

See also: [http://alsa.opensrc.org/index.php?page=alsa-oss aoss].

Test

Test the driver. Are you feeling lucky today? (TM). You can try to play a stereo wav soundfile. For now use aplay, which is a program that is part of the alsa-utils packages and should be able to play correctly in all supported soundcards. Use the following incantation:

["aplay"] only understands .wav files.

To test ?"MP3", you can use ["mpg123"] or mplay.

To test midi, you can use ["aplaymidi"]

Troubleshooting

The first card that ALSA finds is usually given index 0 and thus is usually the 'default' sound card. If you are unlucky then the first sound card found is one that it not suitable for playing system sounds

You can see what indexes have been assigned to cards by running:

  cat /proc/asound/cards

There are two ways to fix this problem.

1. Force the cards to load in a different order. I chose this route, and added the following to my /etc/modprobe.d/sound:

  options snd-trident index=0
  options snd-usb-audio index=1

This forces my Trident card to be the default (card 0) and my USB microphone to be card 1.

2. Change the default card by editing /etc/asound.conf or ~/.asound.conf

Boot

Make sure that the sound driver is started and stopped when the machine boots and shuts down. For that use the ["chkconfig"] utility to add the alsasound script to the proper RunLevel:

/sbin/chkconfig --add alsasound

If you want, you can check that the script was added by doing:

/sbin/chkconfig --list alsasound

At this point you should be able to reboot your computer and have the alsa sound driver start automatically.

AudioGroup

If you have not done it yet, add your user to the audio group and ["logout"] and ["login"] again.

 adduser username audio

Version

Look at /proc/asound/version and that this says something like:

 Advanced Linux Sound Architecture Driver Version 1.0.4.

and that the version is 1.0.4 or above.

More information

For more information, read the README.Debian files in the alsa-base and alsa-source packages or check out http://www.alsa-project.org and http://alsa.opensrc.org.

See also: AlsaMidi.

New, just in:

Older