<!doctype linuxdoc system>
<article>
<title>Alsa-sound-mini-HOWTO
<author>Valentijn Sessink <tt/valentyn@alsa-project.org/
<date>v2.0-pre1, 12 November 1999
<abstract>Describes the installation of the ALSA sound drivers for Linux. 
These sound drivers can be used as a replacement for the regular sound drivers, as they are fully compatible.
</abstract>
<toc>
<sect>Introduction
<p>
This is the ALSA Sound drivers mini-HOWTO. It gives you information about
installing and using the ALSA sound drivers for your soundcard. The ALSA
drivers are fully modularized sound drivers that support kerneld and
kmod. They are compatible with, but surpass the possibilities of, the current
OSS API. In other words: compatible, but better.
<sect1>
Acknowledgments
<p>
This documents contains information I got from the ALSA driver page. The
structure was ripped off the SB-mini-HOWTO, mainly because it had about
the structure I was looking for. Thanks to the <htmlurl url="http://www.sgmltools.org" name="SGML">
Tools package, this HOWTO is available in several formats, all generated
from a common source file. Thanks to Erik Warmelink for proof
reading, thanks to Alfred Munnikes
for a couple of questions and helpful suggestions. Yamahata Isaku thanks for the Japanese
translation, Miodrag Vallat for the translation in French. Later on, Steve Crowder did a great 
job by reading and editing the whole text. Thanks to Cserna Zsolt for the Hungarian translation and Marco Meloni for
the Italian one.
Thanks to Mohamed Ismail Mohamed-Ibrahim who sent me a document about the Trident 4DWave DX/NX soundcard
with a lot of useful information, thanks to Gerard Haagh who sent me a lot of useful information and
who also pointed out a few unclear sections.

Thanks to Marc-Aur`ele Darche, Piotr Ingling, Juergen Kahrs, Tim Pearce, Patrick Stoddard, Rutger de Graaf, 
Shuly Wintner, Jyrki Saarela, Jonas Lofwander, Kumar Sankaran and many others for useful tips and additions.
<sect1>
Revision History
<p>
Version 2.0-pre1 - November 12, 1999. Updating a couple of sections to ALSA 0.4.1e., added various links.

Version 1.7 - July 29, 1999. A few fixes.

Version 1.6 - July 26, 1999. Added a section about ALSA-versions

Version 1.5 - May 21, 1999. Changed the mixer section, added a quick install section

Version 1.4 - May 18, 1999. Included the URL to the French version, changed more URLs.

Version 1.3 - May 16, 1999. Thanks to Jaroslav this HOWTO has found a home at the ALSA-project website. 
As a result of that, some updates in mail and web addresses.

Version 1.2 - May 11, 1999. Several updates.

Version 1.1 - March 11, 1999. Added a couple of sound cards from the new 0.3 series drivers, wrote a bit 
about the 2.2 series kernel.

Version 1.0 - February 8, 1999. Added a few things to the troubleshooting section, but we seem fairly complete.

Version 0.3 beta - January 20, 1999. A link on the ALSA-homepage. Ha, we're official!

Version 0.2 alpha - Mid January 1999, first .sgml-version.

Version 0.1 alpha - January 1999, first version, mostly HTML.

Still: please submit any patches in plain English, you native speakers!

There are a couple of additions that need to be added to the HOWTO now. Notably, 
Mohamed Ismail Mohamed-Ibrahim and Gerard Haagh wrote wonderful additions to the HOWTO, that will keep me
off my regular work for some more time. So this is 2.0-pre1 and more pre's are to follow.

<sect1>
New versions of this document
<p>
The latest version can be found at <htmlurl url="http://www.alsa-project.org/~valentyn" 
name="http://www.alsa-project.org./&tilde;valentyn">

Other formats (full size html, sgml, txt) are in the directory 
<htmlurl url="http://www.alsa-project.org/~valentyn/other-formats" 
name="other-formats">. Unfortunately, I have not succeeded in compiling a Postscript version,
as the sgml2latex-script returns a bunch of errors.

Yamahata Isaku has translated a Japanese version, which will be available
at the Japanese ALSA site, <htmlurl url="http://plaza21.mbn.or.jp/~momokuri/alsa/index.html" 
name="http://plaza21.mbn.or.jp/&tilde;momokuri/alsa/index.html">

Miodrag Vallat translated a French version, which is available at 
<htmlurl url="http://www.freenix.fr/unix/linux/HOWTO/mini/Alsa.html"
name="http://www.freenix.fr/unix/linux/HOWTO/mini/Alsa.html">.

Cserna Zsolt has translated the Hungarian version of the ALSA-HOWTO. You can find
it at <htmlurl url="http://kib4.vein.hu/~zsolt/alsa.html"
name="http://kib4.vein.hu/~zsolt/alsa.html">.

Marco Meloni did an Italian version, you can get it at <htmlurl url="http://pluto.linux.it/ildp/index.html"
name="http://pluto.linux.it/ildp/index.html">.

If you make a translation of this document into another language, let
me know and I'll include a reference to it here. Ook een Nederlandse versie is welkom, ik heb zelf geen
tijd om deze te schrijven. Leve de koningin!
<sect1>
Feedback
<p>
I rely on you, the reader, to make this HOWTO useful. If you have any suggestions,
corrections or comments, please send them to me (<htmlurl url="mailto:alsa-howto@alsa-project.org" name="alsa-howto@alsa-project.org">), 
and I will try to incorporate them in the next revision.
<p>Please note: I do not get a lot of mail about the ALSA drivers and any addition is welcome. Even a 
``thank you for'' is appreciated - maybe it's not too much work to add a ``I appreciated most'' or 
``this-or-that was not immediately clear to me''-section.
<p>If you publish this document on a CD-ROM or in hardcopy form, a complimentary
copy would be appreciated. Mail me for my postal address. Also consider
making a donation to the Linux Documentation Project to help support free
documentation for Linux. Contact the Linux HOWTO co-ordinator, Tim Bynum
<htmlurl url="mailto:linux-howto@metalab.unc.edu" name="linux-howto@metalab.unc.edu">,
for more information.
<sect1>
Distribution Policy
<p>
Copyright 1998/1999 Valentijn Sessink
<p>This HOWTO is free documentation; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
<p>This document is distributed in the hope that it will be useful, but
<bf>without
any warranty</bf>; without even the implied warranty of
<bf>merchantability</bf>
or <bf>fitness for a particular purpose</bf>. See the GNU General Public
License for more details.
<p>You can obtain a copy of the GNU General Public License by writing to
the <htmlurl url="http://www.fsf.org" name="Free Software Foundation">, Inc., 675
Mass Ave, Cambridge, MA 02139, USA.
<p>
<sect>
NOWTO - a quick install guide
<p>
If you want sound and you want it NOW! and not after reading this HOWTO, this quick tour through
the ALSA driver installation might be of help. Please note: there are a couple of differences between
the ALSA versions that support 2.0 kernels and those that support 2.2 kernels.
<sect1>
Installing ALSA for kernels 2.2.x
<p>
You will probably want to use the ALSA 0.4.1e (or later) version if your kernel is 2.2.x.
If your kernel is older, please use 0.3.0-pre4 and see below.
<p>
Just the all time ``./configure - make - make install'' stuff. Do this for <bf>drivers, library and utilities</bf>.
You need all three because the utilities help you to unmute your card. Kernels 2.2.x need to have <bf>general 
sound support</bf> in the kernel (without choosing a specific card).

The ALSA drivers have their own devices, you can make them usinge the <bf>./snddevices</bf> script.

You need to load the module for your card (or use kmod)
and if you want sound to be backwards compatible with the Linux kernel sound drivers (yes you want this) you need
two other modules called <bf>snd-pcm1-oss</bf> and <bf>snd-mixer-oss</bf>. See the section 
<ref id="which-modul" name="Which module for which card"> to find
out which module to load. After loading, you can look in /proc/asound
for various information about the ALSA drivers.
<sect1>
Playing and recording sound
<p>
A few remarks. ALSA has it's own devices in /dev/snd, for example /dev/snd/pcmC0D1 is Card 0, Device 1. 
You can use the old /dev/pcmXY devices if you loaded snd-pcm1-oss for backwards compatibility. You'll also want
to use /dev/mixer, so load snd-mixer-oss as well. Before you can
play any sound, you need to unmute the card with ``amixer''. Type ``amixer groups'', then try something like 

<tt>amixer set PCM 100 unmute</tt>

Generally you can use options ``mute'' or ``unmute'', ``capture'' or ``nocapture'' and numbers.

That's it! Now if it works, it works. If it doesn't work, you may need to actually read this HOWTO...

<sect1>
Installing ALSA for 2.0.x
<p>
The ALSA drivers versions 0.3.0, 0.3.1 and 0.3.2 have various problems due to the
restructuring of the mixer interface. Later versions do not support kernel 2.0.x, so you definately will want to
use version 0.3.0-pre4 if you have a 2.0 version kernel.
<p>
Just the all time ``./configure - make - make install'' stuff. Do this for <bf>drivers, library and utilities</bf>.
You need all three because the utilities help you to unmute your card. Kernels 2.0.x need to have all <bf>sound
support disabled</bf> in the kernel setup

The ALSA drivers have their own devices, you can make them usinge the <bf>./snddevices</bf> script.

You need to load the module for your card (or use kmod)
and if you want sound to be backwards compatible with the Linux kernel sound drivers (yes you want this) you need
another modules called <bf>snd-pcm1-oss</bf>. See the section 
<ref id="which-modul" name="Which module for which card"> to find
out which module to load. After loading, you can look in /proc/asound
for various information about the ALSA drivers.
<sect1>
Playing and recording sound
<p>
A few remarks. ALSA has it's own devices in /dev/snd, for example /dev/snd/pcmC0D1 is Card 0, Device 1. 
You can use the old /dev/pcmXY devices if you loaded snd-pcm1-oss for backwards compatibility. Before you can
play any sound, you need to unmute the card with ``amixer''. Type ``amixer'', then try something like 

<tt>amixer pcm 100 unmute</tt>

Generally you can use options ``mute'' or ``unmute'', ``rec'' or ``norec'', numbers or left:right.

That's it! Now if it works, it works. If it doesn't work, you may need to actually read this HOWTO...
<sect>
Before you start
<p>

<sect1>
Introduction
<p>
This document tries to help you install and use the ALSA sound drivers
in your Linux system. The reference system is a Slackware 4.0 distribution
of Linux on an AMD/K6 computer (x86 compatible), but it should work with
any other Linux distribution. I do not know if the ALSA drivers work on
other platforms, according to the documentation, Alpha has been tested and proven to work. 
I have only x86 PC's here, so any additional information you may have would be appreciated.

It might be handy to read the Linux
Sound HOWTO (see section Other HOWTO's), but that HOWTO focuses on the built-in kernel drivers.
<sect1>
General information about the ALSA drivers
<p>
The ALSA sound driver was originally written as a replacement for the Linux
kernel sound for Gravis UltraSound (GUS) cards. As this GUS replacement proved to be a success, 
the author started the ALSA project for a generic
driver for several sound chips, with fully modularized design.

It is compatible with the OSS/Free and OSS/Linux sound drivers (the drivers in the kernel),
but has its own interface that is even better than the OSS drivers. A list
of features can be found at <htmlurl url="http://www.alsa-project.org/intro.html" name="http://www.alsa-project.org/intro.html">

Please note that the ALSA drivers are still under development. Things may change over time, and some programs that
rely on ALSA only work under specific versions of it. Apart from that: I think they're great. I use ALSA for 10 months now and
will never go back to the dark ages of closed source sound drivers - hint ;)

The main page of the ALSA project is <htmlurl url="http://www.alsa-project.org/" name="http://www.alsa-project.org/">

<sect1>
Supported hardware
<p>
The ALSA drivers support only a subset of all sound cards available.
As the
time of writing, the following cards are supported.
<itemize>
<item>
Cards with a Trident 4D Wave DX/NX chipset, thanks to Trident Microsystems who 
offered ALSA ``first cut'' GPL'd drivers (MIXER and PCM devices only) and documentation for
their 4D Wave PCI audio chipsets. 
See http://www.tridentmicro.com/HTML/products&percnt;20folder/audio.htm for more information.

Cards using this chipset include: Best Union  Miss Melody 4DWave PCI, HIS  4DWave PCI,
Warpspeed  ONSpeed 4DWave PCI, AzTech  PCI 64-Q3D, Addonics  SV 750, CHIC  True Sound 4Dwave,
Shark  Predator4D-PCI and Jaton SonicWave 4D.

<item>
Gravis Ultrasound (GUS): ``PnP'',&nbsp; Extreme, Classic/ACE, MAX</item>

<item>
Cards with a GUS chipset: Dynasonic 3-D, STB Sound Rage 32, UltraSound
32-Pro (STB), ExpertColor MED3201 and others with AMD InterWave&trade; chip, notably some STB cards by Compaq</item>

<item>
Soundblaster: 1.0, 2.0, Pro, 16, AWE32/64, PCI64</item>

<item>
ESS AudioDrive ESx688</item>

<item>
ESS ES968 chip based cards (PnP only).

<item>
ESS ES18xx (chipsets). Please note that I personally experienced a lot of 
trouble with the ESS1888. The developer of the driver for this card did his best, but to no avail.</item>

<item>
ESS Solo-1 ES1938 and ES1946. Only one of the two channels works, which means that recording is not possible. The 
author of the ES1938 code ``is aware of the problem and is currently investigating it''.</item>

<item>
Yamaha: OPL3-SA2, OPL3-SA3 (chipsets)</item>

<item>
OAK Mozart</item>

<item>
Schubert 32 PCI (PINE, S3 SonicVibes PCI chipset)</item>

<item>
Ensoniq AudioPCI ES1370/1371 PCI soundcards (Soundblaster PCI64)</item>

<item>
SonicVibes PCI soundcards (PINE Schubert 32 PCI)</item>

<item>
ForteMedia FM801 based cards (in 0.3.2)</item>

<item>
OPTi 82C9xx chipset based soundcards</item>

<item>
AD1847, AD1848 and CS4248 chipset based cards</item>

<item>
AZT2320 chip based soundcards (PnP only).</item>

<item>
Advance Logic ALS100/ALS120 based cards</item>

<item>
C-Media CMI8330 based cards</item>

</itemize>
Then a whole lot of Crystal Semiconductors-based sound boards are supported.
These chips can be found in a lot of hardware, in separate cards (some
Philips PCA series) and on motherboards (e.g. IBM Aptiva, Dell computers). Boards
based on the following chipsets are supported:
<itemize>

<item>
4231</item>

<item>
4232</item>

<item>
4232A</item>

<item>
4235</item>

<item>
4236B</item>

<item>
4237B</item>

<item>
4238B</item>

<item>
4239</item>

<item>
4280</item>

<item>
4610</item>

<item>
4612</item>

<item>
4614</item>

<item>
4615</item>

<item>
4680</item>

</itemize>
The best thing is: ALSA now supports computers without a soundcard to produce video! This is done with a dummy
driver, that tricks programs like Realplayer into thinking that there is a sound card available.

A more recent list may be found inside the driver package itself, that
is in doc/SOUNDCARDS
<sect1>
Other HOWTO's
<p>
This ALSA-sound-mini-HOWTO is just mini - although it seems to grow fast. Other HOWTO's may help you out in case
this one is too terse. I will name a few things you may come across while trying to
install the ALSA drivers. HOWTO's can generally, be found at mirrors of Metalab (the former Sunsite). So
take a look at <htmlurl url="http://metalab.unc.edu/LDP/mirrors.html" name="http://metalab.unc.edu/LDP/mirrors.html">
and pick out your closest mirror site. You can find HOWTO's in the directory LDP/HOWTO/.
Please note: the links in this document will all be relative to /LDP/HOWTO/mini. If you 
look at this document from a reasonably good mirror site, you will find the HOWTO's.

Then a note for the 2.2.x kernel series. For the 2.2.x kernel series, sound support is like any other support: it works,
but it is different from what you used to do. This HOWTO (like any other HOWTO) will from version 2.0pre1 concentrate
on the 2.2 series kernel, although I'll try to point out the differences.
<sect2>
Sound cards
<p>
Perhaps you bought a sound card already, or maybe it has been installed in your computer for ages. And
now you are going to use it! Have a look at the <htmlurl url="../Sound-HOWTO.html" name="Sound-HOWTO">
to see if this is all worth the trouble. (You might want to buy this new Mega-Rumble-Blaster first, 
then try the ALSA drivers.)
<sect2>
Plug and Play cards
<p>
Most modern sound cards for the Intel platform are ISA PnP cards, which is an
abbreviation for ''Plug and Play''. This means, that the card has to be
configured by the operation system. This has to be done through an
initialization routine at boot time. You probably need to configure your
card with the PnP-utils-package. Every recent Linux distribution
includes these tools. For usage have a look at the 
<htmlurl url="../Plug-and-Play-HOWTO.html" name="Plug-and-Play-HOWTO">

The ALSA-drivers seem to have built in their own ISA-PnP-support for a couple of sound cards. Unfortunately,
as I cannot find documentation about this, I cannot tell you how it works. If anyone out there wants to
try ALSA sound support while deliberately not using the ISA-PnP-tools, please drop me a line.
<sect2>
Loadable modules
<p>
The ALSA sound drivers are built as modules. You can find more information
about modules in the <htmlurl url="../Kernel-HOWTO.html" name="Kernel-HOWTO">.
There is also a module-HOWTO, but that is unmaintained at the moment; take a 
look at the umaintained section of the Howto-HOWTO. There is a 
<htmlurl url="Modules.html" name="Modules-mini-HOWTO"> though that may be useful.
<sect2>
Kerneld
<p>
Another HOWTO that will be useful for some, is the <htmlurl url="Kerneld.html" name="Kerneld-mini-HOWTO">.
Kerneld is a daemon that installs and removes kernel modules as
needed. (I have zero experience with it, so additional information on the
topic is welcome. The ALSA driver documentation contains some information
about configuration of the kerneld, this has been included in this mini-HOWTO.)

As the kernel module loader is included in kernel 2.2.x, things have changed. But as I am one of those guys that
rather modprobes something than have some daemon handle it, I have no info on this.

<sect>
How to install ALSA sound drivers
<p>

<sect1>
What you need
<p>

<itemize>
<item>
a functional Linux system (e.g. the Slackware distribution), with the "Development"
packages installed (i.e. gcc, make etc.)</item>

<item>
some knowledge about Linux (meaning you know how to use "ls", "cd", "tar"
etc.)</item>

<item>
a root-account</item>
</itemize>
The great thing is: you don't need a supported sound card anymore, as ALSA now has a dummy driver that does nothing!
(No, it really does nothing, but some programs will work now that they believe there is a sound card available).

If you have a PnP card, you will also need:
<itemize>
<item>
the isapnptools software package.</item>
</itemize>
The INSTALL text in the driver directory suggests that for some cards, PnP
support is native. I also received a suggestion from Jaroslav about this.
When I get further information about this topic I will add it to this
mini-HOWTO.

Please note that you should not have any sound drivers active when you want
to use the ALSA drivers. If you have a kernel with sound drivers compiled
in, you'll need a kernel recompilation. If you have the old "sound.o" module
active, you need to deactivate it. If you use kerneld, this probably means 
deleting sound.o from the /lib/modules/&lt;kernel_version&gt;/misc directory.
Newer RedHat systems have a different
sound approach, with several sound modules active. You need to deactivate
them all.

The 2.2 series kernel has a new approach to sound. You should include sound support here ! Yep, that's
right: you add sound support to the kernel, but do not include any sound card. Then compile and install
the kernel and after that, compile the ALSA-drivers.

<sect1>
Getting the drivers
<p>
The ALSA drivers are available from 
<htmlurl url="ftp://ftp.alsa-project.org/pub/" name="ftp://ftp.alsa-project.org/pub/">
and there are mirrors at <itemize>
<item>US: <htmlurl url="ftp://ftp.silug.org/pub/alsa" name="ftp://ftp.silug.org/pub/alsa"></item>
<item>US: <htmlurl url="ftp://ftp.eecs.umich.edu/pub/linux/alsa" name="ftp://ftp.eecs.umich.edu/pub/linux/alsa"></item>
<item>Netherlands: <htmlurl url="ftp://linux.a2000.nl/alsa" name="ftp://linux.a2000.nl/alsa"></item>
<item>Poland: <htmlurl url="ftp://ftp.task.gda.pl/pub/linux/misc/alsa" name="ftp://ftp.task.gda.pl/pub/linux/misc/alsa"></item>
<item>Germany: <htmlurl url="ftp://ftp.tu-clausthal.de/pub/linux/alsa" name="ftp://ftp.tu-clausthal.de/pub/linux/alsa"></item>
<item>Slovakia: <htmlurl url="ftp://ftp.phacka.sk/pub/alsa" name="ftp://ftp.phacka.sk/pub/alsa"></item>
<item>Australia: <htmlurl url="ftp://ftp.suburbia.com.au/pub/alsa" name="ftp://ftp.suburbia.com.au/pub/alsa"></item>
</itemize>

For a fully functional ALSA-installation, you will need the driver, the
libs and the utilities; e.g if you chose the A2000 mirror you would
get ftp://linux.a2000.nl/alsa/driver/alsa-driver-0.4.1e.tar.gz, ftp://linux.a2000.nl/alsa/lib/alsa-lib-0.4.1d.tar.gz
and ftp://linux.a2000.nl/alsa/utils/alsa-utils-0.4.1.tar.gz

<sect1>
ALSA versions
<p>
The ALSA drivers have come a long way. Development started during the 2.0 version kernel,
then the 2.2 series showed up (with their own sound kernel).

As the 0.4 versions work perfectly for me, I think it is safe to use 0.4.1e (or newer, if you want). If you have a 2.0.x kernel,
you will definately not want to use 0.3.0 or later. Instead, use alsa-driver-0.3.0-pre4, alsa-lib-0.3.0-pre4
and alsa-utils-0.3.0-pre3.

The older versions, 0.2.0-pre10p3 and older do work under 2.0.x, but I cannot get them to work under 2.2.x (probably
due to the lack of interfacing with the soundcore module of the kernel).

<sect1>
Extracting
<p>
You extract the drivers by some reasonable command, like the all-time tar
-zxf &lt;file>. Most likely you would do that in the /usr/src directory, so you need root priviliges for this. 
Type ``su'' and then the root password to become root. But please note: it is unwise to use your system as the ``root''
user if it is not necessary. So:

<tscreen><verb>cd /usr/src</verb></tscreen>

<tscreen><verb>tar -zxf &tilde;/alsa-driver-0.4.1e.tar.gz</verb></tscreen>

<tscreen><verb>tar -zxf &tilde;/alsa-lib-0.4.1d.tar.gz</verb></tscreen>

<tscreen><verb>tar -zxf &tilde;/alsa-utils-0.4.1.tar.gz</verb></tscreen>
Also working and more fun: find &tilde; -name alsa* -exec tar -zxf {} &bsol;;
(Don't try this at home kids, it's just an example). Note that when downloading
the drivers with Netscape, you may accidentally get unpacked drivers with
a ".tgz" extension. If tar complains about the file format, you may get
better results by leaving off the "z" in the tar options.
<sect1>
Compiling
<p>
You need the drivers before you can compile and use the libs. You need
the libs before you can compile or use the utils. So let's begin:
<tscreen><verb>cd alsa-driver-0.4.1e</verb></tscreen>
(and for those not so experienced: try typing a &lt;tab> (the "tab"-key)
after "alsa-d". That's called <it>command line completion</it>.)
<tscreen><verb>./configure</verb></tscreen>
If you want to use the built-in PnP interfacing, you should use
<tscreen><verb>./configure --with-isapnp=yes</verb></tscreen>


<tscreen><verb>make</verb></tscreen>
Now you need to be 'root' to install the stuff (you probably were "root"
already)
<tscreen><verb>make install</verb></tscreen>
If this tells you that something like ``version.h'' cannot be found, then you probably do not have
a proper kernel source tree. You need a couple of files of your kernel source to be able to
compile the ALSA-drivers. Unpack your favorite linux-2.x.y.tar.gz in /usr/src, and issue a
<tt>make menuconfig</tt>. (Actually, <tt>make symlinks</tt> may be enough).
Now compile the libraries:
<tscreen><verb>cd ../alsa-lib-0.4.1d</verb></tscreen>

<tscreen><verb>./configure</verb></tscreen>

<tscreen><verb>make</verb></tscreen>

<tscreen><verb>make install</verb></tscreen>
OK, you're getting it, the utilities:
<tscreen><verb>cd ../alsa-utils-0.4.1</verb></tscreen>

<tscreen><verb>./configure</verb></tscreen>

<tscreen><verb>make</verb></tscreen>

<tscreen><verb>make install</verb></tscreen>
Note: you can leave out the "make install" for the utilities at first.
You could even leave out the whole library-making and utility-making, just
to check if the driver works.
<sect1>
Preparing the devices
<p>
There is a script in the driver-directory that will install the ALSA-sound-devices
in your /dev directory. Type
<tscreen><verb>./snddevices</verb></tscreen>
from the driver-directory. There should be a /dev/snd subdirectory now
(test if it is there. If you are not familiar with even the "ls" command,
please consider reading other HOWTO's first. You should have some basic
Linux knowledge to install these drivers).
<p>Now you're ready to insert the driver, so please turn over to the next
paragraph.
<sect>
Loading the driver
<p>
There are two ways to use the ALSA-sound-modules. I personally prefer using
the manual method, meaning that I insert the driver at startup. The ALSA-drivers
were designed as loadable/unloadable modules - for instance they do not
reset the mixer after loading - so you can easily use the kerneld approach.

Please do read the section <ref id="backw-compat" name="Backwards Compatibility">.
 You need it to have sound support ``the old way''.
<sect1>
Inserting with modprobe
<p>
Note: If you have a PnP audio-card, you first need to set it to the right
(or at least some known) IO/IRQ/DMA. See the Plug-and-Play-HOWTO. Did
you configure your Plug-and-Play-soundcard? Ok, then read on please.
The main part is: do a "modprobe snd-card-&lt;soundcard>". This should do
the trick. Please note that not all distributions do include /sbin in your path.
If you get a "bash: modprobe: command not found", this will most
likely mean that modprobe is not in your path. Try ``/sbin/modprobe snd-card-sb16'',
or try to find the modprobe utility elsewhere.

The most important difficulty is with the Crystal chipsets, for these
the ALSA-drivers are not auto probing. More recent information may be acquired
from the INSTALL file in the driver-directory. Two examples, then a list:
Gravis UltraSound (GUS) and compatibles:
<tscreen><verb>/sbin/modprobe snd-card-gusclassic</verb></tscreen>
For all 16-bit Soundblaster-cards (SoundBlaster 16 (PnP), SoundBlaster
AWE 32 (PnP), SoundBlaster AWE 64 (PnP):
<tscreen><verb>/sbin/modprobe snd-card-sb16</verb></tscreen>
However, if you have a 0.3.0-pre4 package, the GUS Classic driver is called ``snd-gusclassic'' and the
SoundBlaster 16 module is called ``snd-sb16'' (so, without the ``card'' part).

<sect1>Which module for which card?<label id="which-modul"><p>
Please note that ALSA versions before 0.4.x sometimes had different names. You need to leave out the ``card'' part for those
drivers. This is indicated by an asterisk (*).

<sect2>Gravis UltraSound Extreme <ref id="no-card" name="(*)"><p>

<tt/modprobe snd-card-gusextreme/
<sect2>Gravis UltraSound MAX <ref id="no-card" name="(*)"><p>

<tt/modprobe snd-card-gusmax/

<sect2>ESS AudioDrive <ref id="no-card" name="(*)"><p>
ESS AudioDrive ES-1688 and ES-688 soundcards

<tt/modprobe snd-card-audiodrive1688/

<sect2>ESS AudioDrive 18xx <ref id="no-card" name="(*)"><p>
ESS AudioDrive ES-18xx based soundcards

<tt/modprobe snd-card-audiodrive18xx/

<sect2>Gravis UltraSound PnP <ref id="no-card" name="(*)"><p>
Gravis UltraSound PnP, Dynasonic 3-D/Pro, STB Sound Rage 32,  ExpertColor MED3201 and other
soundcards based on AMD InterWave&trade; chip.

<tt/modprobe snd-card-interwave/
<sect2>UltraSound 32-Pro <ref id="no-card" name="(*)"><p>
UltraSound 32-Pro (soundcard from STB used by Compaq) and other soundcards
based on AMD InterWave (tm) chip with TEA6330T circuit for extended control
of bass, treble and master volume

<tt/modprobe snd-card-interwave-stb/
<Sect2>Soundblaster <ref id="no-card" name="(*)"><p>
8-bit Soundblaster cards (SoundBlaster 1.0, SoundBlaster 2.0, SoundBlaster
Pro)

<tt/modprobe snd-card-sb8/
<Sect2>Soundblaster 16 <ref id="no-card" name="(*)"><p>
16-bit SoundBlaster cards (SoundBlaster 16 (PnP), SoundBlaster AWE
32 (PnP), SoundBlaster AWE 64 (PnP). Please note: this module does not support the SoundBlaster VibraX16 soundcard.

<tt/modprobe snd-card-sb16/
<sect2>OAK Mozart <ref id="no-card" name="(*)"><p>

<tt/modprobe snd-mozart/
<sect2>OPTi 82C9xx <ref id="no-card" name="(*)"><p>
Various sound cards that use the OPTi 82C9xx chipset, like Audio 16 Pro EPC-SOUN9301 (82C930 based),
ExpertColor MED-3931 v2.0 (82C931 based), ExpertMedia Sound 16 MED-1600 (82C928 based - AD1848),
Mozart S601206-G (OPTI601 based - CS4231) and Sound Player S-928 

<tt/modprobe snd-card-opti9xx/
<sect2>AD1847/48 and CS4248<p>

<tt/modprobe snd-card-ad1848/
<Sect2>Yamaha OPL3-SA2/SA3 soundcards <ref id="no-card" name="(*)"><p>
Just "modprobe snd-opl3sa" will not work, this driver does not do autoprobing.
See below.
<Sect2>S3 SonicVibes <ref id="no-card" name="(*)"><p>
S3 SonicVibes PCI soundcards. (PINE Schubert 32 PCI)

<tt/modprobe snd-card-sonicvibes/

<Sect2>Ensoniq/Soundblaster PCI64 <ref id="no-card" name="(*)"><p>
Ensoniq AudioPCI ES1370/1371 PCI soundcards. (SoundBlaster PCI 64)

<tt/modprobe snd-card-audiopci/
<sect2>CS4231<p>
Just ``modprobe snd-card-cs4231'' will not work, no auto-probing. See below.
<Sect2>CS4232/4232A<p>
All soundcards based on CS4232/CS4232A chips.
Just "modprobe snd-card-cs4232" will not work, no auto-probing. See
below.

<Sect2>4235 and higher<p>
All soundcards based on CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 chips. 
Just "modprobe snd-card-cs4236" will not work, no auto-probing. See below.

<sect2>4610/4612/4615 and 4680<p>

<tt/modprobe snd-card-cs461x/
<sect2>ESS Solo 1 <ref id="no-card" name="(*)"><p>
ESS Solo-1, 128iPCI card (es1938, ESS-SOLO-1). Jonas Lofwander sent me a link to a document that will help you installing
this card - which is, basically, nothing more than
<tt/modprobe snd-card-esssolo1/
... but <htmlurl url="http://dice.shopcenter.nu/alsa/" name="http://dice.shopcenter.nu/alsa/">
can be of help. If you have an IBM Thinkpad 1412 you can also refer to
<htmlurl url="http://www.geocities.com/SiliconValley/Peaks/3649/1412.html"
name="http://www.geocities.com/SiliconValley/Peaks/3649/1412.html">, thanks to Kumar Sankaran.
<sect2>Trident 4DWave DX/NX <ref id="trident" name="(**)"><p>
Best Union  Miss Melody 4DWave PCI, HIS  4DWave PCI, Warpspeed  ONSpeed 4DWave PCI,
AzTech  PCI 64-Q3D, Addonics  SV 750, CHIC  True Sound 4Dwave, Shark  Predator4D-PCI,
Jaton  SonicWave 4D. 

<tt/modprobe snd-card-trident/
<sect2>ForteMedia FM801<p>
These are PCI cards based on the FM801 chip.

<tt/modprobe snd-card-fm801/

<bf>(*)</bf><label id="no-card">
For ALSA version 0.3.0-pre4, you need to leave out the ``card-'' part in most (not all!) of the drivernames.
So ``snd-card-sb16'' becomes ``snd-sb16'', however, ``snd-card-cs4232'' remains ``snd-card-cs4232''
(modprobe snd-cs4232 will do something, but it will not produce any sound!)
<p>
<bf>(**)</bf><label id="trident">
In older ALSA versions this driver was called ``snd-card-trid4wave'' and ``snd-trid4wave''.

<p>
<sect1>
modprobe for drivers without auto-probing
<p>
If you have a non-autoprobing driver, you need to supply additional info
at startup to have the driver work. More information can be found in the
file INSTALL in the driver directory.
<sect2>
OPL3-SA2 and OPL3-SA3
<p>
According to the INSTALL file you need to supply all the information for
this driver. If you initialized the card with the isapnp-tools, you can
probably get info from the /etc/isapnp.conf file for the following values:
<tscreen><verb>snd&lowbar;port - control port &num; for OPL3-SA chip
snd&lowbar;wss&lowbar;port - WSS port &num; for OPL3-SA chip (0x530,0xe80,0xf40,0x604)
snd&lowbar;midi&lowbar;port - port &num; for MPU-401 UART (0x300,0x330), -1 = disable
snd&lowbar;fm&lowbar;port - FM port &num; for OPL3-SA chip (0x388), -1 = disable
snd&lowbar;irq - IRQ &num; for OPL3-SA chip (5,7,9,10)
snd&lowbar;dma1 - first DMA &num; for Yamaha OPL3-SA chip (0,1,3)
snd&lowbar;dma1&lowbar;size - max first DMA size in kB (4-64kB)
snd&lowbar;dma2 - second DMA &num; for Yamaha OPL3-SA chip (0,1,3), -1 = disable
snd&lowbar;dma2&lowbar;size - max second DMA size in kB (4-64kB)</verb></tscreen>
You would do a "modprobe snd-card-opl3sa snd&lowbar;port=0xNNN snd&lowbar;wss&lowbar;port=0x530 snd&lowbar;midi&lowbar;port=-1
snd&lowbar;fm&lowbar;port=0x388 snd&lowbar;irq=5 snd&lowbar;dma1=0 snd&lowbar;dma1&lowbar;size=NN snd&lowbar;dma2=1 snd&lowbar;dma2&lowbar;size=NN"
to load this driver (without midi-support. I am still convinced that midi-support
is the thing you need when you have synthesizers and stuff and want to
connect them to your Linux box. Never needed Midi-support even to play
midi-files.)

Note that the "NN" values need to be supplied, only I do not know what
would be reasonable values. I do not know if the dma size option is really required.

If you happen to have an IBM Thinkpad with this chipset, then 
<htmlurl url="http://www.cirs.org/patrick/index.html" name="http://www.cirs.org/patrick/index.html"> might be of help.

If you use the driver from 0.3.0-pre4, then leave out the ``card-'' part in the name.

<sect2>
CS4231 chips
<p>
According to the INSTALL file you need to supply the main port for this
card. Note that with the driver for 3235/6/7/8/9 cards, the one below,
I ended up supplying all information (except DMA-size), otherwise the driver did not work.
So you may as well use the whole command line to insert the driver. If
you initialized the card with the isapnp-tools, you can probably get info
from the /etc/isapnp.conf file for the following values:
<tscreen><verb>snd&lowbar;port - port &num; for CS4232 chip (PnP setup - 0x534)
snd&lowbar;mpu&lowbar;port - port &num; for MPU-401 UART (PnP setup - 0x300), -1 = disable
snd&lowbar;irq - IRQ &num; for CS4232 chip (5,7,9,11,12,15)
snd&lowbar;mpu&lowbar;irq - IRQ &num; for MPU-401 UART (9,11,12,15)
snd&lowbar;dma1 - first DMA &num; for CS4232 chip (0,1,3)
snd&lowbar;dma1&lowbar;size - max first DMA size in kB (4-64kB)
snd&lowbar;dma2 - second DMA &num; for Yamaha CS4232 chip (0,1,3), -1 = disable
snd&lowbar;dma2&lowbar;size - max second DMA size in kB (4-64kB)</verb></tscreen>
You would do a "modprobe snd-card-cs4231 snd&lowbar;port=0x534 
snd&lowbar;mpu&lowbar;port=-1 snd&lowbar;irq=5 snd&lowbar;dma1=0 snd&lowbar;dma1&lowbar;size=NN
snd&lowbar;dma2=1 snd&lowbar;dma2&lowbar;size=NN" to load the driver for a "standard configured"
soundcard. (Without midi-support, see the note at Yamaha OPL-3).
If you used different values in /etc/isapnp.conf, then
you would use the values here also (Note: it can be wise to use your brains
anyway ;)

Note that the "NN" values need to be supplied, only I do not know what
would be reasonable values. I do not know if the dma size option is really required.

<sect2>
CS4232/CS4232A chips
<p>
According to the INSTALL file you need to supply the main port for this
card. Note that with the driver for 3235/6/7/8/9 cards, the one below,
I ended up supplying all information (except DMA-size), otherwise the driver did not work.
So you may as well use the whole command line to insert the driver. If
you initialized the card with the isapnp-tools, you can probably get info
from the /etc/isapnp.conf file for the following values:
<tscreen><verb>snd&lowbar;port - port &num; for CS4232 chip (PnP setup - 0x534)
snd&lowbar;cport - control port &num; for CS4232 chip (PnP setup - 0x120)
snd&lowbar;mpu&lowbar;port - port &num; for MPU-401 UART (PnP setup - 0x300), -1 = disable
snd&lowbar;fm&lowbar;port - FM port &num; for CS4232 chip (PnP setup - 0x388), -1 = disable
snd&lowbar;jport - joystick port for CS4232 chip (PnP setup - 0x200), -1 =
disable
snd&lowbar;irq - IRQ &num; for CS4232 chip (5,7,9,11,12,15)
snd&lowbar;mpu&lowbar;irq - IRQ &num; for MPU-401 UART (9,11,12,15)
snd&lowbar;dma1 - first DMA &num; for CS4232 chip (0,1,3)
snd&lowbar;dma1&lowbar;size - max first DMA size in kB (4-64kB)
snd&lowbar;dma2 - second DMA &num; for Yamaha CS4232 chip (0,1,3), -1 = disable
snd&lowbar;dma2&lowbar;size - max second DMA size in kB (4-64kB)</verb></tscreen>
You would do a "modprobe snd-card-cs4232 snd&lowbar;port=0x534 snd&lowbar;cport=0x120
snd&lowbar;mpu&lowbar;port=-1 snd&lowbar;fm&lowbar;port=0x388 snd&lowbar;jport=-1 snd&lowbar;irq=5 snd&lowbar;dma1=0 snd&lowbar;dma1&lowbar;size=NN
snd&lowbar;dma2=1 snd&lowbar;dma2&lowbar;size=NN" to load the driver for a "standard configured"
soundcard. (Without midi-support, see the note at Yamaha OPL-3, and no
joystick support). If you used different values in /etc/isapnp.conf, then
you would use the values here also (Note: it can be wise to use your brains
anyway ;)

Note that the "NN" values need to be supplied, only I do not know what
would be reasonable values. I do not know if the dma size option is really required.
<sect2>
CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 chips
<p>
According to the INSTALL file you need to supply the main port and control
ports for this card. Note that with a CS4237B card, I ended up supplying
all information (except DMA-size), otherwise the driver did not work. So you may as well
use the whole command line to insert the driver, and not only supply snd&lowbar;port
and snd&lowbar;cport. If you initialized the card with the isapnp-tools, you can
probably get info from the /etc/isapnp.conf file for the following values:
<tscreen><verb>snd&lowbar;port - port &num; for CS4232 chip (PnP setup - 0x534)
snd&lowbar;cport - control port &num; for CS4232 chip (PnP setup - 0x120)
snd&lowbar;mpu&lowbar;port - port &num; for MPU-401 UART (PnP setup - 0x300), -1 = disable
snd&lowbar;fm&lowbar;port - FM port &num; for CS4232 chip (PnP setup - 0x388), -1 = disable
snd&lowbar;jport - joystick port for CS4232 chip (PnP setup - 0x200), -1 = disable
snd&lowbar;irq - IRQ &num; for CS4232 chip (5,7,9,11,12,15)
snd&lowbar;mpu&lowbar;irq - IRQ &num; for MPU-401 UART (9,11,12,15)
snd&lowbar;dma1 - first DMA &num; for CS4232 chip (0,1,3)
snd&lowbar;dma1&lowbar;size - max first DMA size in kB (4-64kB)
snd&lowbar;dma2 - second DMA &num; for Yamaha CS4232 chip (0,1,3), -1 = disable
snd&lowbar;dma2&lowbar;size - max second DMA size in kB (4-64kB)</verb></tscreen>
You would do a "modprobe snd-card-cs4236 snd&lowbar;port=0x534 snd&lowbar;cport=0x120
snd&lowbar;mpu&lowbar;port=-1 snd&lowbar;fm&lowbar;port=0x388 snd&lowbar;jport=-1 snd&lowbar;irq=5 snd&lowbar;dma1=0 snd&lowbar;dma1&lowbar;size=NN
snd&lowbar;dma2=1 snd&lowbar;dma2&lowbar;size=NN" to load the driver. (Without midi-support,
see the note at Yamaha OPL-3, and no joystick support).
Notes:
<itemize>
<item>the "NN" values need to be supplied, only I do not know what
would be reasonable values.</item>
<item>my CS4237B works fine without explicit dma size option.</item>
</itemize>
<sect1>
The kerneld approach
<p>
<tt>kerneld</tt> is a daemon that inserts modules on request, and unloads them once
they are not in use anymore. Since I have no experience with kerneld, I
do not know if the information below is accurate. The info comes from the
INSTALL file in the ALSA-drivers package. Excellent information about kerneld
can be found in the kerneld-mini-HOWTO.
<p>Follow these steps:
<itemize>
<item>
Edit your /etc/conf.modules (see below for examples)</item>

<item>
Run 'modprobe snd-card' where card is name of your card &lsqb;Which I find rather
strange, since kerneld is supposed to load them? VS&rsqb;</item>
</itemize>
Example for /etc/conf.modules for Gravis UltraSound PnP soundcard:
<tscreen><verb>alias char-major-14 snd
alias snd-minor-oss-0 snd-interwave
alias snd-minor-oss-3 snd-pcm1-oss
alias snd-minor-oss-4 snd-pcm1-oss
alias snd-minor-oss-5 snd-pcm1-oss
alias snd-minor-oss-12 snd-pcm1-oss
alias snd-card-0 snd-interwave
options snd snd&lowbar;major=14 snd&lowbar;cards&lowbar;limit=1
options snd-interwave snd&lowbar;index=1 snd&lowbar;id="guspnp" snd&lowbar;port=0x220 snd&lowbar;irq=5
snd&lowbar;dma1=5 snd&lowbar;dma2=6</verb></tscreen>
Example if you want use more soundcards in one machine (configuration below
is for Sound Blaster 16 and Gravis UltraSound Classic):
<tscreen><verb>alias char-major-14 snd
alias snd-minor-oss-0 snd-mixer
alias snd-minor-oss-3 snd-pcm1-oss
alias snd-minor-oss-4 snd-pcm1-oss
alias snd-minor-oss-5 snd-pcm1-oss
alias snd-minor-oss-12 snd-pcm1-oss
alias snd-card-0 snd-sb16
alias snd-card-1 snd-gusclassic
options snd snd&lowbar;major=14 snd&lowbar;cards&lowbar;limit=2
options snd-sb16 snd&lowbar;index=1 snd&lowbar;port=0x220 snd&lowbar;irq=5 snd&lowbar;dma8=1 snd&lowbar;dma16=5
options snd-gusclassic snd&lowbar;index=2 snd&lowbar;irq=11 snd&lowbar;dma1=6 snd&lowbar;dma2=7</verb></tscreen>
Example if two Gravis UltraSound Classic soundcards are present in system:
<tscreen><verb>alias char-major-14 snd
alias snd-minor-oss-0 snd-mixer
alias snd-minor-oss-3 snd-pcm1-oss
alias snd-minor-oss-4 snd-pcm1-oss
alias snd-minor-oss-5 snd-pcm1-oss
alias snd-minor-oss-12 snd-pcm1-oss
alias snd-card-0 snd-gusclassic
alias snd-card-1 snd-gusclassic
options snd snd&lowbar;major=14 snd&lowbar;cards&lowbar;limit=2
options snd-gusclassic snd&lowbar;index=1,2 snd&lowbar;port=0x220,0x260 snd&lowbar;irq=5,11
snd&lowbar;dma1=5,6 snd&lowbar;dma2=7,3</verb></tscreen>

<sect1>
Backwards compatibility<label id="backw-compat">
<p>
If you want to preserve OSS/Free or OSS/Linux compatibility, you need to
insert one more driver: the snd-pcm1-oss driver for OSS-compatibility.
Issue a
<tscreen><verb>modprobe snd-pcm1-oss</verb></tscreen>
This will give you /dev/audio and /dev/dsp-support, just as the OSS/Free
(kernel) drivers and OSS/Linux (the &dollar;25 ones) do. Note that this is only
an emulation.

<sect>
Testing and using
<p>
Now you should test if the sound driver really is available, then try to
use it.
<sect1>
The /proc filesystem
<p>
You can find a lot of useful information about your system in the /proc subdirectory. /proc is
a "virtual" filesystem, meaning that it does not exist in real life, but merely is a mapping to
various processes and tasks in your computer. In order for /proc to work, you need to have support
for it compiled into your kernel. Most linux distributions have this as a default, but if you
compiled a kernel and left /proc out obviously there won't be anything in /proc.

/proc/modules gives information about loaded modules. Once the ALSA sound
drivers are loaded, if you type cat /proc/modules you should see
something like:
<tscreen><verb>snd-pcm1-oss      4            0
snd-sb16          1            1
snd-sb-dsp        4    &lsqb;snd-sb16&rsqb;      0
snd-pcm1          4    &lsqb;snd-pcm1-oss snd-sb-dsp&rsqb;      0
snd-pcm           3    &lsqb;snd-pcm1-oss snd-sb16 snd-sb-dsp snd-pcm1&rsqb;    0
snd-mixer         3    &lsqb;snd-pcm1-oss snd-sb16 snd-sb-dsp&rsqb;      1
snd-mpu401-uart   1    &lsqb;snd-sb16&rsqb;      0
snd-midi          4    &lsqb;snd-sb16 snd-sb-dsp snd-mpu401-uart&rsqb;   0
snd-opl3          1    &lsqb;snd-sb16&rsqb;      0
snd-synth         1    &lsqb;snd-sb16 snd-opl3&rsqb;     0
snd-timer         1    &lsqb;snd-opl3&rsqb;      0
snd               8    &lsqb;snd-pcm1-oss snd-sb16 snd-sb-dsp snd-pcm1 snd-pcm snd-mixer snd-mpu401-uart snd-midi snd-opl3 snd-synth snd-timer&rsqb;    0</verb></tscreen>
If something went wrong during the installation of the driver, you will
still see a couple of "snd" devices, but there won't be sound support.

For example (Note: you should never issue this command as follows, the cs4236 driver needs options):
<tscreen><verb>win3:&tilde;&num; modprobe snd-card-cs4236
/lib/modules/2.0.35/misc/snd-card-cs4236.o: init&lowbar;module: Device or resource busy
snd-mixer: Device or resource busy
win3:&tilde;&num; cat /proc/modules
snd-cs4236        2           0
snd-cs4231        3    &lsqb;snd-cs4236&rsqb;    0
snd-timer         1    &lsqb;snd-cs4231&rsqb;    0
snd-pcm1          4    &lsqb;snd-cs4236 snd-cs4231&rsqb; 0
snd-mixer         3    &lsqb;snd-cs4236 snd-cs4231&rsqb; 0
snd-pcm           3    &lsqb;snd-cs4236 snd-cs4231 snd-pcm1&rsqb;       0
snd-mpu401-uart   1           0
snd-midi          4    &lsqb;snd-mpu401-uart&rsqb;       0
snd-opl3          1           0
snd-synth         1    &lsqb;snd-opl3&rsqb;      0
snd-timer         1    &lsqb;snd-cs4231 snd-opl3&rsqb;   0
snd               8    &lsqb;snd-cs4231 snd-timer snd-pcm1 snd-mixer snd-pcm&rsqb;     0</verb></tscreen>
You can check the existence of a soundcard by looking in /proc/asound/cards.
For example:
<tscreen><verb>bash&dollar; cat /proc/asound/cards
0 &lsqb;card1          : SB16 - Sound Blaster 16
                    Sound Blaster 16 at 0x220, irq 5, dma 1&amp;5</verb></tscreen>
In the previous example (where I forgot the options) the output would have
been:
<tscreen><verb>win3:&tilde;&num; cat /proc/asound/cards
--- no soundcards ---</verb></tscreen>
A working CS4236 card would produce
<tscreen><verb>0 &lsqb;card1         &rsqb;: CS4236 - CS4237B
                    CS4237B at 0x534, irq 7, dma 1&amp;0</verb></tscreen>
If you checked and doublechecked your settings and still see no sound card,
take a look at the troubleshooting section.

The <tt>/proc/asound/</tt> virtual directory shows lots of other information
about the driver. Please note that /proc/asound/ will only exist after you inserted 
the first ALSA module. If there is no /proc/asound, it simply means that the "snd"
module was not loaded properly. You can find installed cards in /proc/asound/cards, then
find information about card0 in /proc/asound/0, /proc/asound/1 for card1
etcetera.

If <tt>cat /proc/asound/card1/pcm0</tt> shows something like
<tscreen><verb>      ES1370 DAC2/ADC
      Playback isn't active.
      Record isn't active.</verb></tscreen> this means that your driver is ready to go, but
is not doing anything right now. (So everything went well).

For users of a 2.0.x kernel there is a third method to find information about the sound devices, namely if you inserted
the OSS compatible driver there is a /dev/sndstat device. The ALSA drivers kindly request
that you
not to rely on this information as it is only there for compatibility with the OSS drivers
and better information can easily be obtained from /proc/asound/. In kernel 2.2.x ALSA uses
the kernel soundcore and therefor cannot emulate /dev/sndstat, since it would interfere
with the OSS drivers.

<sect1>
The mixer
<p>
Once the drivers for your sound card have been installed and your /proc
filesystem tells you so, you can try to make a real sound. To do this, you
need to set the mixer volumes to a reasonable value. You need the ``amixer''
from the alsa-utils package for this. First of all,
install the utility package, or at least put the "amixer" command in some
reasonable place (like /usr/local/bin).

Version 0.3.2 and
later have an interface that differs from the OSS drivers. If you type just ``amixer''
you will see the mixer elements and their value. One of these elements
could be ``Master volume'' for example, and could look like:

<tscreen><verb>Group 'Master',0
  Capabilities: volume
  Channels: Front-Left Front-Right 
  Limits: min = 0, max = 31
  Front-Left: 31 [100%] [on] [---]
  Front-Right: 26 [84%] [on] [---]</verb></tscreen>

Unfortunately, I do not know how to set left and right volumes independently. With amixer,
you can change volumes with the ``amixer set'' command. For example, to change the Master
volume, you would issue a

<tscreen><verb>amixer set Master 15</verb></tscreen>

Please note that the names of the elements can be different for different types of sound cards. Also note
that amixer is case dependent, so ``amixer set masteR 10'' will not work.
For more information, please look in the amixer man page.


If you have a 0.3.0-pre4 ALSA, then amixer works just like normal mixer programs.
You can look at the mixer settings
by typing ``amixer''. This command lists the ``mixer settings'', or as you would
normally call it, the volume settings of the various parts of the soundcard. 
The output from amixer can greatly differ from card
to card. My Soundblaster 16 shows:
<tscreen><verb>Master         0  &percnt; (-14.00dB) : 0  &percnt; (-14.00dB)
Bass           0  &percnt; (-14.00dB) : 0  &percnt; (-14.00dB)
Treble         0  &percnt; (-14.00dB) : 0  &percnt; (-14.00dB)
Synth          0  &percnt; (-62.00dB) : 0  &percnt; (-62.00dB)
PCM            0  &percnt; (-62.00dB) : 0  &percnt; (-62.00dB)
Line-In        0  &percnt; (-62.00dB) : 0  &percnt; (-62.00dB) Mute
MIC            0  &percnt; (-62.00dB) : 0  &percnt; (-62.00dB) Mute
CD             0  &percnt; (-62.00dB) : 0  &percnt; (-62.00dB) Mute
In-Gain        0  &percnt; (-18.00dB) : 0  &percnt; (-18.00dB)
Out-Gain       0  &percnt; (-18.00dB) : 0  &percnt; (-18.00dB)
PC Speaker     0  &percnt; (-18.00dB) : 0  &percnt; (-18.00dB)</verb></tscreen>

If you only get a message like ``amixer: Specify command...'', then you are using
the ALSA 3.2 utilities. I suggest you to upgrade to 0.4.1e or later, or to go back to
0.3.0-pre4.

<sect2>
Mixer settings for playing
<p>
You have noticed the "Mute" entry for some devices. This means that this particular
device will be zeroed out, whatever volume setting you use. Some cards 
(the CS4237B in the example) even mute their master channel.
So, for the CS4237B, I would have to type 

<tt>amixer set "Master d" unmute</tt>

to even be able to produce any sound at all. The Soundblaster does not
have muted output, but 

<tt>amixer set Master 100 unmute</tt>

would set the
volume to 100&percnt; - and unmute it if it would have been muted.
You can use a number, a word like
"mute" or "unmute", or both. Type 

<tt>amixer set "Master d" 100; amixer set PCM 100 unmute</tt>

 to set the CS4237B card to maximum master volume and unmute 
PCM volume and set it to maximum.

If you use an older version of amixer, you need to leave out the ``set'' part of the command, so you would
just type

<tt>amixer "master d" 100</tt>

<sect2>
Mixer parts
<p>
The various mixer parts may confuse you if you have no knowledge of digital sound
production. The sound-HOWTO may help a bit, but a very short introduction is here.

You will probably only need few mixer elements: one of them is the ``CD'' setting 
(this is analog sound of your CD player, most CD players are connected
with a 3 or 4 wire red/white/black cable).

The ``PCM'' setting is used for most applications. Programs like 
mpg123, xmms, speakfreely, realplayer and most others use the PCM channel.

``MIC'' stands for
microphone, ``line-in'' is an (optional) extra input at the back of your sound card.

The various ``gain'' parts offer extra amplification for various uses and are pretty
self-explanatory. (Like: record-gain is extra amplification for the recording channel, which
can be useful if you use a microphone).

<sect2>
Mixer settings for recording
<p>
You would set the CD channel to record by typing 

<tt>amixer set CD capture</tt>

and stop the recording setting again by typing 

<tt>amixer set CD nocapture</tt>.

Note that older amixer programs use ``amixer CD rec'' and ``amixer CD norec'' for this.

If you would like to record something from the microphone, you would probably
use 

<tt>amixer set "Input Gain" 100; amixer set Mic 100 capture mute</tt>.

(Using the
microphone input unmuted will produce loud high-pitched sound if your mic
picks up its own signal from the speakers again). Most microphones have 
a ``gain'' setting to boost the microphone volume; you are most likely going
to need it to pick up any sound from the microphone at all.

Again, older amixer programs use ``amixer "input gain" 100; amixer mic 100 rec mute''.

<sect2>
Other mixer settings
<p>
Unfortunately I have not been able to change the volume of the "3d
center" and "3d space" settings with amixer 0.3.0-pre4. I haven't tried yet with 0.4.1e (this particular machine
is still running 2.0.38). If anyone succeeds please
let me know. I can use alsamixer for this job, but alsamixer was not ported to the 0.4.1e version yet.

The ALSA FAQ says that it is possible to restore mixer settings with
<tt>cat &lt;file> > /proc/asound/&num;/mixerC0D0</tt>, where &lt;file> was obtained from
/proc/asound/&num;/mixerC0D0. I have not been able to reproduce this as my system
complains about non-existing devices. Then there is the ``alsactl'' program, which I don't use. I invite you (yes, you!)
to write this section.

<sect1>
The /dev/snd/ devices
<p>
The alsa drivers have native sound-devices in the /dev/snd/ directory.
If you have  one card you might see the following devices:
<tscreen><verb>/dev/snd/pcmC0D0 - the raw audio device for the card
/dev/snd/mixerC0D0 - the mixer for card 0
/dev/snd/controlC0D0 - the control device for card 0</verb></tscreen>
The first number means the number of the soundcard, the second number (if
any) is the number of the device. A sound card with two PCM devices would
have a pcmC0D0 and pcmC0D1 device.
Please note: the ALSA devices have changed between the previous version. Older 
ALSA drivers use /dev/snd/pcm00 (first number is the card, second number is the device).
If this HOWTO uses the older notation, please drop me a line so I can correct it.

Now you are ready to put any soundfile you want into the PCM device
of the first card. So try to cat any textfile (any file) to /dev/snd/pcmC0D0,
like this: <tt>cat &lt;filename> > /dev/snd/pcmC0D0</tt>. The filename can
be any file, as long as it has some length. If you have a soundfile lying
around somewhere, you could try that. You could also get the file at 
<htmlurl url="http://www.ldp.org/sounds/english.au" name="http://www.ldp.org/sounds/english.au">
this is Linus Torvalds saying how to pronounce Linux.

The default setting of your sound device is 8000 Hz, 8 bit. That means that
the "english.au" file mentioned above will produce speech,
other test files will probably just produce noise. If you do not hear anything,
check your speakers, try to run "amixer" again or consult a doctor.
(Later on you can easily use the full 48 KHz, 16 bit features of your sound card, by using
your favourite sound player like sox or mpg123).

If you loaded the ``snd-pcm1-oss'' module, you can also use the OSS-compatibility
to access your sound card. The following mappings are made:
<tscreen><verb>/dev/snd/pcmC0D0 -> /dev/audio0 (/dev/audio) -> minor 4
/dev/snd/pcmC0D0 -> /dev/dsp0 (/dev/dsp) -> minor 3
/dev/snd/pcmC0D1 -> /dev/adsp0 (/dev/adsp) -> minor 12
/dev/snd/pcmC1D0 -> /dev/audio1 -> minor 4+16 = 20
/dev/snd/pcmC1D0 -> /dev/dsp1 -> minor 3+16 = 19
/dev/snd/pcmC1D1 -> /dev/adsp1 -> minor 12+16 = 28
/dev/snd/pcmC2D0 -> /dev/audio2 -> minor 4+32 = 36
/dev/snd/pcmC2D0 -> /dev/dsp2 -> minor 3+32 = 35
/dev/snd/pcmC2D1 -> /dev/adsp2 -> minor 12+32 = 44</verb></tscreen>

You probaly want to use the ``snd-mixer-oss'' module as wel, so you can use the backwards compatible mixer.

<sect1>
Additional information
<p>
The INSTALL file in the ALSA driver directory mentions some tricks to tell
the driver which settings to use. If you need these commands it will depend on the application you
use to play sound. Regular sound playing applications, like mpg123, sox 
(mostly called with the ``play'' command), or X11 applications like RealPlayer will probably
do fine without these. I never used these anyway.
<sect2>
/proc/asound/&num;/pcm&num;0
<p>

<tscreen><verb>"Playback erase" - erase all additional informations about OSS applications
"Playback &lt;app&lowbar;name> &lt;fragments> &lt;fragment&lowbar;size> &lsqb;&lt;options>&rsqb;"
"Record erase" - erase all additional informations about OSS applications
"Record &lt;app&lowbar;name> &lt;fragments> &lt;fragment&lowbar;size> &lsqb;&lt;options>&rsqb;"</verb></tscreen>

<tt>&lt;app&lowbar;name></tt> - name of application with (highter priority) or without path

<tt>&lt;fragments></tt> - number of fragments or zero if auto

<tt>&lt;fragment&lowbar;size></tt> - size of fragment in bytes or zero if auto

<tt>&lt;options></tt> - optional parameters

<tt>WR&lowbar;ONLY</tt> - if application tries open pcm device with O&lowbar;RDWR driver rewrites this to O&lowbar;WRONLY (playback) - good for Quake etc...

Examples:
<tscreen><verb>echo "Playback x11amp 128 16384" > /proc/asound/0/pcm0o
echo "Playback squake 0 0 WR&lowbar;ONLY" > /proc/asound/0/pcm0o</verb></tscreen>
<sect2>
/proc/asound/&num;card&num;/sb16
<p>

<tscreen><verb>"Playback 8" -> driver will use always 8-bit DMA channel for playback.
"Playback 16" -> driver will use always 16-bit DMA channel for playback.
"Playback auto" (default) -> driver will use auto mode (first opened direction will use 16-bit DMA channel).
"Record 8" -> driver will use always 8-bit DMA channel for record.
"Record 16" -> driver will use always 16-bit DMA channel for record.
"Record auto" (default) -> driver will use auto mode (first opened direction will use 16-bit DMA channel).</verb></tscreen>

Example: <tt>echo "Record 16" > /proc/asound/0/sb16</tt>

For further reference, please consult the INSTALL file.
<sect>
Tips and Troubleshooting
<p>
Please take a look at the FAQ file in the sound driver directory. This section is still under construction. 
<sect1>
Compiling the driver
<p>
<sect2>
Linux kernel sourcetree
<p>
If your ALSA drivers do not compile correctly and tell you things about ``version.h'' or other
header-files that cannot be found, this can mean that you do not have the kernel header files.
Take a look at the kernel-HOWTO, unpack a recent kernel in /usr/src and issue a <tt>make config</tt>.

<sect2>
Cannot create executables
<p>
The utils also contain code written in c++. Most of us have a c++ compiler
either from gcc or egcs but make sure you also have the libstdc++-devel
package installed, else when you run the configure script for the utils,
your system will stump you with an error message saying your ``c++ compiler
cannot create executables''.

<sect1>
Loading the driver
<p>
Please check the following items.

<sect2>
Sound devices
<p>
ALSA uses special devices in the /dev-tree. Make sure you have run the ./snddevices script in the
alsa-drivers source directory.

<sect2>
Sound card compatibility
<p>
Are you 100&percnt; sure that your sound card IS supported ? Do check it again. 
Sometimes an X123 is not exactly an X123b and you might be wasting time. 
On the other hand, even a supported card can give you troubles - it took me two hours to
figure out the installation of a CS4237B which was, after all, just a fine example
of RTFM.

<sect2>
``Device busy'' or ``unresolved symbols''
<p>
You might have a 2.0.x kernel with sound support compiled in, or the OSS/Lite (kernel) sound driver
could be loaded (check with <tt>cat /proc/modules</tt>). Remove the driver or recompile
the kernel (have a look at the Kernel-HOWTO). 

The sound module in the 2.0 series kernel is called ``sound.o'' and should <bf>not</bf> be active. 
(The ALSA driver ``snd.o'' is OK, though).

If you have a 2.2.x series kernel without sound driver compiled in, the ALSA drivers will not work, too. 

<sect3>
2.0 kernels
<p>
I know it this is confusing, so let me try to explain it one more time. If you have a 
<bf>2.0.x series kernel</bf> (the command ``uname -a'' tells you something like 
``Linux penguin 2.0.35 #6 Wed Sep 23 10:19:16 CEST 1998 i686 unknown'') then 
you need to <bf>leave out</bf> sound drivers in the kernel. <bf>ALSA 0.4.x and later do not work with the
2.0 series kernel</bf>

<sect3>
2.2 kernels
<p>
If you have a <bf>2.2.x series kernel</bf> you do <bf>need the sound drivers</bf>. A 2.2 series kernel should 
be compiled <bf>with sound support, but without any sound card driver</bf>. So you select sound support but
make sure that no specific sound card driver will be compiled.

<sect2>
References to other drivers
<p>
Another reason why the driver complains that the device is busy could be that the file /etc/conf.modules still
has references to the soundcard drivers. You should delete these and leave only the references to the ALSA-driver.
(If there are other non-sound-related drivers there, then you can probably leave these as-is).

<sect2>
Unresolved symbols revisited
<p>
Another source of ``unresolved symbols'' messages could be a new kernel with older drivers. Please 
recompile the ALSA drivers after you recompile a new kernel. This will make sure that the drivers
match your new kernel.

<sect2>
Check the PnP setup
<p>
Are you sure that your card is active? Take another look at the PnP-HOWTO and check if
you activated your sound card correctly.

<sect2>
Are your parameters right ?
<p>
Check, doublecheck your sound card parameters. Please note: 534 is not 543,
nor is 0x534 the same as 534.

Also, some sound cards must be loaded by a different name than might be expected. Take a break,
a beer or whatever, and look again at your ``modprobe'' command. For example the Crystal 4232
driver should be inserted by modprobe snd-card-cs4232, not ``snd-cs4231'', and the SoundBlaster
PCI 64 should be loaded with ``snd-card-audiopci'', not snd-es1370. (It's all in the docs, and even
though I wrote the HOWTO, I once spent an evening trying to persuade snd-cs4231 
to make sound).

<sect1>
Driver loaded... but no (or hardly any) sound
<p>

<sect2>
Unmuting
<p>
The ALSA drivers can use the ``muting'' facilities that most soundcards have. If you 
loaded the sound drivers and everything is fine but you get nothing but silence, then you probably
forgot to unmute your card. You need ``amixer'' or ``alsamixer'' for this, both from the ALSA-util package.
Just typing 
<tscreen><verb>amixer set -c 1 Master 70 unmute
amixer set -c 1 PCM 70 unmute
amixer set -c 1 CD 70 unmute</verb></tscreen>
should do for most applications. Please note that for the older amixer command you need to leave out the
``set'' in the command line.

<sect2>
Gain
<p>
Most sound cards have a separate mixer part for extra input or output boosting. This entry is most likely called
the ``gain'', ``in-gain'' for input and ``out-gain'' for output. Setting this gain to an appropriate level will
greatly help you getting the maximum volume out of your speakers (think about your parents/neighbours/ears
though).
So a command like
<tscreen><verb>amixer set out-gain 100 unmute</verb></tscreen>
will probably help.

<sect2>
OSS/Linux compatibility
<p>
If this is the first time you use the ALSA drivers and you used the built-in sound drivers before, you
probably want to have backwards compatible sound (i.e. use the /dev/pcmX devices). You need to load the
``OSS compatibility driver'' for this. Do a <tt>modprobe snd-pcm1-oss && modprobe snd-mixer-oss</tt>. (See the end of the
section about loading the driver). Please note: snd-pcm1-oss is not equal to snd-pcm1, you <bf>need</bf>
snd-pcm1-oss for old-fashioned sound support and snd-mixer-oss for (you guessed it) the mixer.

<sect2>
Cannot open mixer
<p>
If you have tried to install a couple of different ALSA versions, then sometimes the mixer
cannot be opened anymore. This happens if you have tried 0.3.2 and want to downgrade to 0.3.0-pre4 (IIRC). You should
delete all libasound files and links from /usr/lib and then recompile libraries and utils:
<tscreen><verb>rm /usr/lib/libasound.*</verb></tscreen>
Just to be safe, remove all ALSA sound drivers afterwards, then recompile and install and reload the drivers.

<sect1>
General suggestions
<p>

<sect2>
Try using ``insmod''
<p>
It can always be useful to start with "insmod" instead of kerneld. Maybe you 
actually see the error on screen.

<sect2>
Read the INSTALL file.
<p>
A lot of information can be found in the INSTALL file in the drivers directory. If your driver
won't work check if there is additional information available.

<sect2>
Debug messages
<p>
As a last resort, you can rebuild the driver and tell it to send debug information
to /var/log/messages. Go to the driver-directory with <tt>cd /usr/src/alsa-driver-....</tt>
and type:

<tscreen><verb>./configure --with-debug=detect; make clean; make</verb></tscreen>

Remove the driver (as far as it is active, see below for a general remove statement).
Then use the "modprobe" statement you used before to insert the newly compiled driver.
Look in /var/log/messages if there are any messages.

<sect2>
If all else fails...
<p>
If these messages doesn't help you, send a message to the ALSA users mailing list, 
<htmlurl url="mailto:alsa-user@alsa-project.org" name="alsa-user@alsa-project.org">.

Include the following information:
<itemize>

<item>
soundcard name + chip names present on your soundcard</item>

<item>
relevant sections in your isapnp.conf if you have ISA PnP soundcard</item>

<item>
your conf.modules or line which you activate ALSA driver</item>

<item>
all messages from /var/log/messages which should be relevant to the
ALSA driver</item>
</itemize>

<sect1>
Bug reports
<p>
If you found a bug, the ALSA developers would like to know the following things
(at minimum)
<enum>
<item> driver + kernel version: 'cat /proc/asound/version'
<item>soundcard info
<itemize>
<item>soundcard name provided by manufacture
<item>list of chips which soundcard have onboard
<item>contents of 'cat /proc/asound/cards'
</itemize>
<item>all messages from /var/log/messages which should be relevant to ALSA driver
<item>problem description
</enum>

<sect1>
Tip: playing CD's
<p>
If you use kmod/kerneld and the ALSA drivers to play CD's, then kmod/kerneld probably do not
load the drivers as expected. This is due to the fact that a command line CD player only tells
the CD player to start playing without using any of the devices that tell kmod/kerneld that
there is sound to occur. Using modprobe may be your only solution to this problem.

<sect1>
Tip: installing the MIDI serial driver
<p>
Normally, the IO port of the serial device is owned by the standard
serial device driver. So before you can do ``modprobe snd-serial'' we have to tell
the driver to release the serial device.

Here is the procedure. 

<tscreen><verb>setserial /dev/ttyS0 uart none
modprobe snd-serial</verb></tscreen>

(Replace /dev/ttyS0 with the appropriate /dev/ttySx device if your MIDI device uses a different serial device).

<sect1>
Tip: new kernel? New modules!
<p>
After you upgrade your kernel, you probably need to recompile the ALSA drivers. If they are still
in the original /usr/src directory, then please do not forget to issue a <tt>make clean</tt> before
you do the ./configure, make, make install thing.

Oh, and then there is this anomaly in kernel numbering: a ``2.2.0ac1'' kernel that is ``not a number''
- says the configure script. I think this was resolved in newer scripts, otherwise you should maybe 
change the kernel version in the source.

<sect1>
Tip: KDE and ALSA drivers
<p>
Suppose you have KDE up and running but you cannot get system sounds to work,
like for opening windows, changing desktops, etc. Sound works in general.
If your cd player and mp3 player and mixer all do work, then it's probably
just "kwmsound" that's lacking.

So: make sure "kwmsound" is in your startscript ($KDEDIR/bin/startkde)

<sect1>
Tip: use the ALSA devices
<p>
If you had sound support in your Linux before, then your applications will probably all point
to /dev/pcm0, /dev/audio and /dev/mixer. This is fine, if you use OSS compatibility with the
snd-pcm1-oss module. It might be better, however, to use the real ALSA devices, those found
in /dev/snd/.

<sect1>
Tip: removing all modules
<p>
Removing 10+ modules one by one is not the way to go. Luckily, 
all modules start with the "snd-" prefix, so a little command line programming will do.
You can easily remove ALSA sound by issuing a command like:

<tscreen><verb>cat /proc/modules|gawk '/^snd-/{print $1}'|xargs -i rmmod {}</verb></tscreen>

Juergen Kahrs wrote: ``I have a script that also removes soundcore and soundlow and sound if 
present and if they are not in use. This script processes /proc/modules three times so 
there should not be too many modules left after processing''. His solution is

<tscreen><verb>awk '/^snd/||/^sound/&amp;&amp;(&dollar;3==0){system("rmmod " $1)}' /proc/modules /proc/modules /proc/modules</verb></tscreen>

Please note: if some module is dependent on another module you cannot just remove the "higher" one.
This means that you might need to issue a second removal statement. (I never encountered this
situation though, it seems that you can remove the ALSA modules in the order they appear in /proc/modules).

</article>
