Alsa Sound mini-HOWTO Valentijn Sessink v0.0, 8 February 1999 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. ______________________________________________________________________ Table of Contents 1. Introduction 1.1 Acknowledgments 1.2 Revision History 1.3 New versions of this document 1.4 Feedback 1.5 Distribution Policy 2. Before you start 2.1 Introduction 2.2 General information about the Alsa drivers 2.3 Supported hardware 2.4 Other HOWTO's 2.4.1 Sound cards 2.4.2 Plug and Play cards 2.4.3 Loadable modules 2.4.4 Kerneld 3. How to install Alsa sound drivers 3.1 What you need 3.2 Getting the drivers 3.3 Extracting 3.4 Compiling 3.5 Preparing the devices 4. Loading the driver 4.1 Inserting with modprobe 4.2 Which module for which card? 4.2.1 Gravis UltraSound Extreme 4.2.2 Gravis UltraSound MAX 4.2.3 ESS AudioDrive 4.2.4 Gravis UltraSound PnP 4.2.5 UltraSound 32-Pro 4.2.6 Soundblaster 4.2.7 Soundblaster 16 4.2.8 Yamaha OPL3-SA2/SA3 soundcards 4.2.9 S3 SonicVibes 4.2.10 Ensoniq/Soundblaster PCI64 4.2.11 CS4232/4232A 4.2.12 4235 and higher 4.3 modprobe for drivers without auto-probing 4.3.1 OPL3-SA2 and OPL3-SA3 4.3.2 CS4232/CS4232A chips 4.3.3 CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 chips 4.4 The kerneld approach 4.5 Backwards compatibility 5. Testing and using 5.1 The /proc filesystem 5.2 The mixer 5.3 The /dev/snd/ devices 5.4 Additional information 5.4.1 /proc/asound/#/pcm#0 5.4.2 /proc/asound/#card#/sb16 6. Tips and Troubleshooting 6.1 Troubleshooting: activation of the driver 6.1.1 Linux kernel sourcetree 6.1.2 OSS/Linux compatibility 6.1.3 Sound card compatibility 6.1.4 OSS/Lite or kernel-driver 6.1.5 Check the PnP setup 6.1.6 Are your parameters right? 6.1.7 Try using ``insmod'' 6.1.8 Read the INSTALL file. 6.1.9 Debug messages 6.1.10 If all else fails... 6.2 Bug reports 6.3 Tip: playing CD's 6.4 Tip: new kernel? New modules! 6.5 Tip: KDE and Alsa drivers 6.6 Tip: use the Alsa devices 6.7 Tip: removing all modules ______________________________________________________________________ 1. Introduction 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. 1.1. Acknowledgments 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 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. 1.2. Revision History Version 0.1 alpha - januari 1999, first version, mostly HTML. Version 0.2 alpha - mid januari 1999, first .sgml-version. Version 0.3 beta - januari 20, 1999. A link on the Alsa-homepage. Ha, we're official! Version 1.0 - februari 8, 1999. Added a few things to the troubleshooting section, but we seem fairly complete. 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. Still: please submit any patches in plain English, you native speakers! 1.3. New versions of this document The latest version can be found at http://huizen.dds.nl/~valentyn Yamahata Isaku has translated a Japanese version, which will be available at the Japanese Alsa site, http://plaza21.mbn.or.jp/ momokuri/alsa/index.html Miod Vallat will work on a French translation - I'll include the URL here as soon as I know it. If you make a translation of this document into another language, let me know and I'll include a reference to it here. 1.4. Feedback I rely on you, the reader, to make this HOWTO useful. If you have any suggestions, corrections, or comments, please send them to me (valentyn@dds.nl), and I will try to incorporate them in the next revision. 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. 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 coordinator, Tim Bynum linux-howto@sunsite.unc.edu, for more information. 1.5. Distribution Policy Copyright 1998/1999 Valentijn Sessink 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. This document is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details. You can obtain a copy of the GNU General Public License by writing to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 2. Before you start 2.1. Introduction This document tries to help you install and use the Alsa sound drivers in your Linux system. The reference system is a Slackware 3.5 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 proved to work. I have only x86 PC's here, so any additional info is 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. 2.2. General information about the Alsa drivers The Alsa sound driver was originally written as a replacement for the Linux kernel sound for Gravis UltraSound (GUS) cards. It has evolved to 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 http://alsa.jcu.cz/intro.html The main page of the Alsa project is http://alsa.jcu.cz/ 2.3. Supported hardware The Alsa drivers support only a subset of all sound cards available. As time of writing, the following cards are supported: · Gravis Ultrasound (GUS): "PnP", Extreme, Classic/ACE, MAX · cards with a GUS chipset: Dynasonic 3-D, STB Sound Rage 32, UltraSound 32-Pro (STB) · Soundblaster: 1.0, 2.0, Pro, 16/AWE, PCI64 · ESS AudioDrive ESx688 · ESS ES18xx (chipsets) · ESS Solo-1 ES1938 · Yamaha: OPL3-SA2, OPL3-SA3 (chipsets) · OAK Mozart · Schubert 32 PCI (PINE, S3 SonicVibes PCI chipset) · Ensoniq AudioPCI ES1370/1371 PCI soundcards (Soundblaster PCI64) · SonicVibes PCI soundcards (PINE Schubert 32 PCI) 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 (IBM Aptiva, Dell computers). Boards based on the following chipsets are supported: · 4232 · 4232A · 4235 · 4236B · 4237B · 4238B · 4239 A more recent list may be found inside the driver package itself, that is in doc/SOUNDCARDS 2.4. Other HOWTO's This Alsa-sound-mini-HOWTO is just mini. Other HOWTO's may help you out in case this one is too terse. I will name a few things you may come accross while trying to install the Alsa drivers. HOWTO's can, generally, be found at mirrors of sunsite. So take a look at http://sunsite.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 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 concentrate on the 2.0 series kernel, although I'll try to point out the differences. I will gladly add anything that can make this HOWTO up to date with the 2.2 series. 2.4.1. Sound cards Perhaps you bought a sound card already, or maybe it's stuck down there in your computer for ages. And now you are going to use it! Have a look at the 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.) 2.4.2. Plug and Play cards 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, and 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 reasonably recent Linux distribution includes these. For usage, have a look at the 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. 2.4.3. Loadable modules The Alsa sound drivers are built as modules. You can find more information about modules in the 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 Modules-mini- HOWTO though that may be useful. 2.4.4. Kerneld Another HOWTO that will be useful for some, is the Kerneld-mini-HOWTO. Kerneld is a daemon that installs and removes kernel modules as needed. (I have zero experience with it, so additional info 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.) 3. How to install Alsa sound drivers 3.1. What you need · a functional Linux system (e.g. the Slackware distribution), with the "Development" packages installed. (i.e. gcc, make etc.) · a supported sound card · some knowledge about Linux (meaning you know how to use "ls", "cd", "tar" etc.) · a root-account If you have a PnP card, you will also need: · the isapnptools software package. 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//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. 3.2. Getting the drivers The Alsa drivers are available from ftp://alsa.jcu.cz/pub/, and there is a mirror at ftp://linux.a2000.nl/alsa For a fully functional Alsa- installation, you need the driver, the libs and the utilities; for example, if you chose the mirror you would get ftp://linux.a2000.nl/alsa/driver/alsa-driver-0.2.0-pre10p3.tar.gz, ftp://linux.a2000.nl/alsa/lib/alsa-lib-0.3.0pre2.tar.gz and ftp://linux.a2000.nl/alsa/utils/alsa-utils-0.0.8.tar.gz (and NO these are not full links, you'd better look at the original place if there are newer versions available. Simply get the last one). 3.3. Extracting You extract the drivers by some reasonable command, like the all-time tar -zxf . For newbies and for those with amnesia: cd /usr/src tar -zxf ~/alsa-driver-0.2.0-pre10p3.tar.gz (If this worked you either are logged in as root always, which is the wrong way, stop here and read the DOS/Win95-to-Linux-HOWTO, or you already thought this would be the administrative thing you needed rootprivs for. So: for this, you need rootprivs, type a "su" and the password). tar -zxf ~/alsa-lib-0.3.0pre2.tar.gz tar -zxf ~/alsa-utils-0.0.8.tar.gz Also working and more fun: find ~ -name alsa* -exec tar -zxf {} \; (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. 3.4. Compiling 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: cd alsa-driver-0.2.0-pre10p3 (and for those not so experienced: try typing a (the "tab"-key) after "alsa-d". That's called command line completion.) ./configure make Now you need to be 'root' to install the stuff (you probably were "root" already) make install 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 make menuconfig. (Actually, make symlinks may be enough). Now compile the libraries: cd ../alsa-lib-0.3.0 ./configure make make install OK, you're getting it, the utilities: cd ../alsa-utils-0.0.8 ./configure make make install 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. 3.5. Preparing the devices There is a script in the driver-directory that will install the Alsa- sound-devices in your /dev directory. Type ./snddevices 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" com­ mand, please consider reading other HOWTO's first. You should have some basic Linux knowledge to install these drivers). Now you're ready to insert the driver, so please turn over to the next paragraph. 4. Loading the driver There are two ways to use the Alsa-sound-modules. I personally prefer using the manual method, meaning 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 about backward compatibility (the last section of this paragraph. I did not find out how to use links inside a .sgml document yet). You need it to have sound support ``the old way''. 4.1. Inserting with modprobe 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-". This should do the trick. 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-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: /sbin/modprobe snd-gusclassic For all 16-bit Soundblaster-cards (SoundBlaster 16 (PnP), SoundBlaster AWE 32 (PnP), SoundBlaster AWE 64 PnP): /sbin/modprobe snd-sb16 4.2. Which module for which card? 4.2.1. Gravis UltraSound Extreme modprobe snd-gusextreme 4.2.2. Gravis UltraSound MAX modprobe snd-gusmax 4.2.3. ESS AudioDrive ESS AudioDrive ES-1688 and ES-688 soundcards modprobe snd-audiodrive1688 4.2.4. Gravis UltraSound PnP Gravis UltraSound PnP, Dynasonic 3-D/Pro, STB Sound Rage 32 and other soundcards based on AMD InterWave (tm) chip. modprobe snd-interwave 4.2.5. UltraSound 32-Pro 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 modprobe snd-interwave-stb 4.2.6. Soundblaster 8-bit Soundblaster cards (SoundBlaster 1.0, SoundBlaster 2.0, SoundBlaster Pro) modprobe snd-sb8 4.2.7. Soundblaster 16 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. modprobe snd-sb16 4.2.8. Yamaha OPL3-SA2/SA3 soundcards Just "modprobe snd-opl3sa" will not work, this driver does not do autoprobing. See below. 4.2.9. S3 SonicVibes S3 SonicVibes PCI soundcards. (PINE Schubert 32 PCI) modprobe snd-sonicvibes 4.2.10. Ensoniq/Soundblaster PCI64 Ensoniq AudioPCI ES1370/1371 PCI soundcards. (SoundBlaster PCI 64) modprobe snd-audiopci 4.2.11. CS4232/4232A All soundcards based on CS4232/CS4232A chips. Just "modprobe snd- card-cs4232" will not work, no auto-probing. See below. 4.2.12. 4235 and higher All soundcards based on CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 chips. Just "modprobe snd-card-cs4236" will not work, no auto- probing. See below. 4.3. modprobe for drivers without auto-probing 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. 4.3.1. OPL3-SA2 and OPL3-SA3 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: snd_port - control port # for OPL3-SA chip snd_wss_port - WSS port # for OPL3-SA chip (0x530,0xe80,0xf40,0x604) snd_midi_port - port # for MPU-401 UART (0x300,0x330), -1 = disable snd_fm_port - FM port # for OPL3-SA chip (0x388), -1 = disable snd_irq - IRQ # for OPL3-SA chip (5,7,9,10) snd_dma1 - first DMA # for Yamaha OPL3-SA chip (0,1,3) snd_dma1_size - max first DMA size in kB (4-64kB) snd_dma2 - second DMA # for Yamaha OPL3-SA chip (0,1,3), -1 = disable snd_dma2_size - max second DMA size in kB (4-64kB) You would do a "modprobe snd-opl3sa snd_port=0xNNN snd_wss_port=0x530 snd_midi_port=-1 snd_fm_port=0x388 snd_irq=5 snd_dma1=0 snd_dma1_size=NN snd_dma2=1 snd_dma2_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 con­ nect 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. 4.3.2. CS4232/CS4232A chips 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: snd_port - port # for CS4232 chip (PnP setup - 0x534) snd_cport - control port # for CS4232 chip (PnP setup - 0x120) snd_mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable snd_fm_port - FM port # for CS4232 chip (PnP setup - 0x388), -1 = disable snd_jport - joystick port for CS4232 chip (PnP setup - 0x200), -1 = disable snd_irq - IRQ # for CS4232 chip (5,7,9,11,12,15) snd_mpu_irq - IRQ # for MPU-401 UART (9,11,12,15) snd_dma1 - first DMA # for CS4232 chip (0,1,3) snd_dma1_size - max first DMA size in kB (4-64kB) snd_dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable snd_dma2_size - max second DMA size in kB (4-64kB) You would do a "modprobe snd-card-cs4232 snd_port=0x534 snd_cport=0x120 snd_mpu_port=-1 snd_fm_port=0x388 snd_jport=-1 snd_irq=5 snd_dma1=0 snd_dma1_size=NN snd_dma2=1 snd_dma2_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. 4.3.3. CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 chips 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_port and snd_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: snd_port - port # for CS4232 chip (PnP setup - 0x534) snd_cport - control port # for CS4232 chip (PnP setup - 0x120) snd_mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable snd_fm_port - FM port # for CS4232 chip (PnP setup - 0x388), -1 = disable snd_jport - joystick port for CS4232 chip (PnP setup - 0x200), -1 = disable snd_irq - IRQ # for CS4232 chip (5,7,9,11,12,15) snd_mpu_irq - IRQ # for MPU-401 UART (9,11,12,15) snd_dma1 - first DMA # for CS4232 chip (0,1,3) snd_dma1_size - max first DMA size in kB (4-64kB) snd_dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable snd_dma2_size - max second DMA size in kB (4-64kB) You would do a "modprobe snd-card-cs4232 snd_port=0x534 snd_cport=0x120 snd_mpu_port=-1 snd_fm_port=0x388 snd_jport=-1 snd_irq=5 snd_dma1=0 snd_dma1_size=NN snd_dma2=1 snd_dma2_size=NN" to load the driver. (Without midi-support, see the note at Yamaha OPL-3, and no joystick support). Notes: · the "NN" values need to be supplied, only I do not know what would be reasonable values; · my CS4237B works fine without explicit dma size option. 4.4. The kerneld approach kerneld 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. Follow these steps: · Edit your /etc/conf.modules (see below for examples) · Run 'modprobe snd-card' where card is name of your card [Which I find rather strange, since kerneld is supposed to load them? VS] Example for /etc/conf.modules for Gravis UltraSound PnP soundcard: 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_major=14 snd_cards_limit=1 options snd-interwave snd_index=1 snd_id="guspnp" snd_port=0x220 snd_irq=5 snd_dma1=5 snd_dma2=6 Example if you want use more soundcards in one machine (configuration below is for Sound Blaster 16 and Gravis UltraSound Classic): 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_major=14 snd_cards_limit=2 options snd-sb16 snd_index=1 snd_port=0x220 snd_irq=5 snd_dma8=1 snd_dma16=5 options snd-gusclassic snd_index=2 snd_irq=11 snd_dma1=6 snd_dma2=7 Example if two Gravis UltraSound Classic soundcards are present in system: 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_major=14 snd_cards_limit=2 options snd-gusclassic snd_index=1,2 snd_port=0x220,0x260 snd_irq=5,11 snd_dma1=5,6 snd_dma2=7,3 4.5. Backwards compatibility 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 modprobe snd-pcm1-oss This will give you /dev/audio and /dev/dsp-support, just as the OSS/Free (kernel) drivers and OSS/Linux (the $25 ones) do. Note that this is only an emulation. 5. Testing and using Now you should test if the sound driver really is available, then try to use it. 5.1. The /proc filesystem 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, 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: snd-pcm1-oss 4 0 snd-sb16 1 1 snd-sb-dsp 4 [snd-sb16] 0 snd-pcm1 4 [snd-pcm1-oss snd-sb-dsp] 0 snd-pcm 3 [snd-pcm1-oss snd-sb16 snd-sb-dsp snd-pcm1] 0 snd-mixer 3 [snd-pcm1-oss snd-sb16 snd-sb-dsp] 1 snd-mpu401-uart 1 [snd-sb16] 0 snd-midi 4 [snd-sb16 snd-sb-dsp snd-mpu401-uart] 0 snd-opl3 1 [snd-sb16] 0 snd-synth 1 [snd-sb16 snd-opl3] 0 snd-timer 1 [snd-opl3] 0 snd 8 [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] 0 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): win3:~# modprobe snd-card-cs4236 /lib/modules/2.0.35/misc/snd-card-cs4236.o: init_module: Device or resource busy snd-mixer: Device or resource busy win3:~# cat /proc/modules snd-cs4236 2 0 snd-cs4231 3 [snd-cs4236] 0 snd-timer 1 [snd-cs4231] 0 snd-pcm1 4 [snd-cs4236 snd-cs4231] 0 snd-mixer 3 [snd-cs4236 snd-cs4231] 0 snd-pcm 3 [snd-cs4236 snd-cs4231 snd-pcm1] 0 snd-mpu401-uart 1 0 snd-midi 4 [snd-mpu401-uart] 0 snd-opl3 1 0 snd-synth 1 [snd-opl3] 0 snd-timer 1 [snd-cs4231 snd-opl3] 0 snd 8 [snd-cs4231 snd-timer snd-pcm1 snd-mixer snd-pcm] 0 You can check the existence of a soundcard by looking in /proc/asound/cards. For example: bash$ cat /proc/asound/cards 0 [card1 : SB16 - Sound Blaster 16 Sound Blaster 16 at 0x220, irq 5, dma 1&5 In the previous example (where I forgot the options) the output would have been: win3:~# cat /proc/asound/cards --- no soundcards --- A working CS4236 card would produce 0 [card1 ]: CS4236 - CS4237B CS4237B at 0x534, irq 7, dma 1&0 If you checked and doublechecked your settings and still see no sound card, take a look at the troubleshooting section. The /proc/asound/ 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 cat /proc/asound/ shows something like ES1370 DAC2/ADC Playback isn't active. Record isn't active. , this means that your driver is ready to go, but is not doing any­ thing right now. (So everything went well). 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 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/. 5.2. The mixer 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. First of all, install the utility package, or, at least put the "amixer" command in some reasonable place (like /usr/local/bin). First look at the mixer settings, by typing "amixer". The output from amixer can greatly differ from card to card. My Soundblaster 16 shows: Master 0 % (-14.00dB) : 0 % (-14.00dB) Bass 0 % (-14.00dB) : 0 % (-14.00dB) Treble 0 % (-14.00dB) : 0 % (-14.00dB) Synth 0 % (-62.00dB) : 0 % (-62.00dB) PCM 0 % (-62.00dB) : 0 % (-62.00dB) Line-In 0 % (-62.00dB) : 0 % (-62.00dB) Mute MIC 0 % (-62.00dB) : 0 % (-62.00dB) Mute CD 0 % (-62.00dB) : 0 % (-62.00dB) Mute In-Gain 0 % (-18.00dB) : 0 % (-18.00dB) Out-Gain 0 % (-18.00dB) : 0 % (-18.00dB) PC Speaker 0 % (-18.00dB) : 0 % (-18.00dB) My Crystal 4237B based soundcard has a lot of other options: Master D 0 % (-22.00dB) : 0 % (-22.00dB) Mute 3D Center 0 % (-22.50dB) : 0 % (-22.50dB) 3D Space 0 % (-22.50dB) : 0 % (-22.50dB) Mute Synth 0 % (-94.50dB) : 0 % (-94.50dB) Mute FM 0 % (-94.50dB) : 0 % (-94.50dB) Mute DSP 0 % (-94.50dB) : 0 % (-94.50dB) Mute PCM 0 % (-94.50dB) : 0 % (-94.50dB) Mute Line-In 0 % (-34.50dB) : 0 % (-34.50dB) Mute MIC 0 % (-22.50dB) : 0 % (-22.50dB) Mute CD 0 % (-34.50dB) : 0 % (-34.50dB) Mute Record-Gain 0 % ( 0.00dB) : 0 % ( 0.00dB) In-Gain 0 % (-18.00dB) : 0 % (-18.00dB) Loopback 0 % (-94.50dB) : 0 % (-94.50dB) Mute Mono 0 % (-45.00dB) : 0 % (-45.00dB) Mute Aux A 0 % (-34.50dB) : 0 % (-34.50dB) Mute You have noticed the "Mute" entry, the CS4237B even mutes the master channel. For the CS4237B, I would have to type amixer "master d" unmute to even be able to produce any sound at all. The Soundblaster does not have muted output, but amixer master 100 unmute would set the volume to 100% and unmute the master. You can use a number, a word like "mute" or "unmute", or both. Type amixer "master d" 100; amixer pcm 100 unmute to set the CS4237B card to maximum master volume and unmute PCM volume and set it to maximum. For separate L/R settings you use a colon, for example amixer CD 25:50. (No, I don't know which You would set the CD channel to record by typing amixer cd rec and stop the recording setting again by typing amixer cd norec. If you would like to record something from the microphone, you would probably use amixer record-gain 100; amixer mic 100 rec mute. (Using the microphone input unmuted will produce loud high-pitched sound if your mic picks up its own signal from the speakers again). Unfortunately, I have not been able to change the volume of the "3d center" and "3d space" settings with amixer. If anyone succeeds, please let me know. You can use alsamixer for this job. The Alsa FAQ says that it is possible to restore mixer settings with cat > /proc/asound/#/mixer0, where was obtained from /proc/asound/#/mixer0. I have not been able to reproduce this, my system complains about non-existing devices. 5.3. The /dev/snd/ devices The alsa drivers have native sound-devices in the /dev/snd/ directory. If you have one card, you might see the following devices: /dev/snd/pcm00 - the raw audio device for the card /dev/snd/mixer0 - the mixer for card 0 /dev/snd/control0 - the control device for card 0 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 pcm00 and pcm01 device. 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/pcm00, like this: cat > /dev/snd/pcm00. 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 http://www.ldp.org/sounds/english.au, this is Linus Torvalds telling 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: /dev/snd/pcm00 -> /dev/audio0 (/dev/audio) -> minor 4 /dev/snd/pcm00 -> /dev/dsp0 (/dev/dsp) -> minor 3 /dev/snd/pcm01 -> /dev/adsp0 (/dev/adsp) -> minor 12 /dev/snd/pcm10 -> /dev/audio1 -> minor 4+16 = 20 /dev/snd/pcm10 -> /dev/dsp1 -> minor 3+16 = 19 /dev/snd/pcm11 -> /dev/adsp1 -> minor 12+16 = 28 /dev/snd/pcm20 -> /dev/audio2 -> minor 4+32 = 36 /dev/snd/pcm20 -> /dev/dsp2 -> minor 3+32 = 39 /dev/snd/pcm21 -> /dev/adsp2 -> minor 12+32 = 44 5.4. Additional information The INSTALL file in the Alsa driver directory mentions some tricks to tell the driver which settings to use. If you need these commands depends on the application you use to play sound. Regular sound playing application, 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. 5.4.1. /proc/asound/#/pcm#0 "Playback erase" - erase all additional informations about OSS applications "Playback []" "Record erase" - erase all additional informations about OSS applications "Record []" - name of application with (highter priority) or without path - number of fragments or zero if auto - size of fragment in bytes or zero if auto - optional parameters WR_ONLY - if application tries open pcm device with O_RDWR driver rewrites this to O_WRONLY (playback) - good for Quake etc... Examples: echo "Playback x11amp 128 16384" > /proc/asound/0/pcm0o echo "Playback squake 0 0 WR_ONLY" > /proc/asound/0/pcm0o 5.4.2. /proc/asound/#card#/sb16 "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). Example: echo "Record 16" > /proc/asound/0/sb16 For further reference, please consult the INSTALL file. 6. Tips and Troubleshooting Please take a look at the FAQ file in the sound driver directory. This section is still under construction. 6.1. Troubleshooting: activation of the driver Please check the following items. 6.1.1. Linux kernel sourcetree 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 make config. 6.1.2. OSS/Linux compatibility If you want to use sound exactly as you did before (i.e. use the /dev/pcmX devices), then you need the ``OSS compatibility driver''. Do a modprobe snd-pcm1-oss. (See the end of the section about loading the driver). Please note: snd-pcm1-oss is not equal to snd-pcm1, you _need_ snd-pcm1-oss for old-fashioned sound support. 6.1.3. Sound card compatibility Are you 100% sure that your sound card IS supported? Do check it again. Sometimes an X123 is not exactly an X123b and you might be waisting 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. 6.1.4. OSS/Lite or kernel-driver You might have a kernel with sound support compiled in, or the OSS/Lite (kernel) sound driver could be loaded (check with cat /proc/modules). Remove the driver, or recompile the kernel (have a look at the Kernel-HOWTO). I will say this again, since it is the cause of many troubles: you should NOT have sound support compiled into the kernel, and you should NOT have a ``sound.o'' module active. (The Alsa ``snd.o'' is OK, though). 6.1.5. Check the PnP setup Are you sure that your card is active? Take another look at the PnP- HOWTO, and check if you activated your sound card correctly. 6.1.6. Are your parameters right? Check, doublecheck your sound card parameters. And 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-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). 6.1.7. Try using ``insmod'' It can always be useful to start with "insmod" instead of kerneld. Maybe you actually see the error on screen. 6.1.8. Read the INSTALL file. 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. 6.1.9. Debug messages 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 cd /usr/src/alsa-driver-.... and type: ./configure --with-debug=detect; make clean; make 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. 6.1.10. If all else fails... If these messages doesn't help you, send a message to the Alsa developers mailing list, alsa-devel@alsa.jcu.cz. Include the following information: · soundcard name + chip names present on your soundcard · your isapnp.conf if you have ISA PnP soundcard · your conf.modules or line which you activate ALSA driver · all messages from /var/log/messages which should be relevant to the Alsa driver 6.2. Bug reports If you found a bug, the Alsa developers would like to know the following things (at minimum) 1. driver + kernel version: 'cat /proc/asound/version' 2. soundcard info · soundcard name provided by manufacture · list of chips which soundcard have onboard · contents of 'cat /proc/asound/cards' 3. all messages from /var/log/messages which should be relevant to ALSA driver 4. problem description 6.3. Tip: playing CD's 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. 6.4. Tip: new kernel? New modules! 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 make clean 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. 6.5. Tip: KDE and Alsa drivers 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) 6.6. Tip: use the Alsa devices 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/. 6.7. Tip: removing all modules 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: cat /proc/modules|gawk '/^snd-/{print $1}|xargs -i rmmod {} 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).