Configuring Sound in Debian GNU/Linux 

http://www.tux.org/~tbr/sound-debian/

Introduction 

Like many of my colleagues, I'm making the switch to Debian and finding I have to unlearn a few habits. I love the package management, and I'm learning that less is more: start with the very minimum and then add stuff as I need it. It's certainly true that, when you configure the system directly, rather than trusting a tool to do it, you learn a whole lot more about how it all works.

Setting up a soundcard is a good example. I've always wondered what it is that RedHat's sndconfig really does. Now I think I know. Of course, I also learned a bit about how Debian organizes and manages configuration files.

It's difficult to get straightforward, simple, and up-to-date guidance on how to configure a sound card in Debian; indeed the most likely sources, the Sound HOWTO and the files in /usr/src/linux/Documentation/sound, seem to give conflicting messages.

This document captures what I've learned, with some great help from my colleagues in several LUGS on both coasts of the US. Although it's necessarily oriented around my particular card, I've tried to describe the underlying principles that apply generally, in hopes of helping others (and myself when I need to configure a different card!)

My Configuration 

Platform       Debian 2.2r2 (Potato) from the 3-CD set, default stable archive, on Intel architecture (AMD Athlon 650)
Sound Card     Soundblaster AWE64 ISA PNP. The machine dual boots an inferior (though sound-supporting ;-) operating system, from which I can determine the parameters:
io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330

Overview 

In general, GNU/Linux supports sound by loading kernel modules. You need to:

  1. Identify the sound card or chipset, accurately.
  2. Set up the card's hardware parameters.
  3. Determine which modules the card needs.
  4. Determine what options, if any, these modules require and what values to use.
  5. Ensure the kernel supports the needed modules.
  6. Set up the loading of the sound modules, either manually, or automatically at boot.

What's My Card? 

Determine exactly what sound card you have, or what chipset it uses. Note that most "Soundblaster compatibles" aren't. Sources of information:

  • Look at the actual card and note the identifiers on chips and labels on the circuit board
  • See if your BIOS reports anything when you boot
  • If you've run the card under another OS, see what it reports
  • Look in the docs under /usr/src/linux/Documentation/sound/, especially the READMEs and introductions

Setting Up the Hardware 

If your card, like mine, is an ISA Plug-n-Play model, you need to set up the PNP configuration before the system can even detect it. I understand you can set any parameters the card will allow but, in multi-boot situations, it's a bad idea to set different parameters for the different operating systems.

Configure PNP by tailoring /etc/isapnp.conf as described in various docs under /usr/src/linux/Documentation/sound/, in my case the AWE32 document:

  1. If necessary, install isapnptools.
  2. Create the /etc/isapnp.conf file, if there isn't already one: pnpdump > /etc/isapnp.conf
  3. Edit /etc/isapnp.conf, uncommenting the lines that agree with your configuration and adding lines as necessary (for the AWE23/64, Plug-n-Play detects only one I/O port, but the wavetable needs three). Don't forget to uncomment (ACT Y)! I offer my /etc/isapnp.conf as an example.
  4. Activate the new PNP configuration: isapnp /etc/isapnp.conf No errors should be reported. If you correctly installed isapnptools, then isapnp will run every boot time.

What Modules? 

Armed with a clear idea of what soundcard/chipset you have, study the docs under /usr/src/linux/Documentation/sound/, including the introduction, the READMEs, and anything that seems remotely related to your card. Some things aren't obvious, for example, it seems most sound cards need the opl3 module. Most modules require options (not an oxymoron! the option is which value to set, not whether to set one). The docs should supply the correct names and, in many cases, the values.

For my Soundblaster AWE64 card, I need:

Module         Options
sb     io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330
awe_wave       (none)
opl3   io=0x388

loaded in that order.

Configuring the Kernel 

If you're using an out-of-the-box kernel, it almost certainly has support already compiled in for all likely modules, including sound, so you don't need to do any further configuration. On the other hand, if you're building a new kernel, you'll need to include support for the sound modules.

/usr/src/linux/Documentation/sound/README.OSS will tell you everything you need to know.

Loading the Modules 

The quick-and-dirty way is to load the modules directly, using modprobe, for example:

modprobe sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330
modprobe awe_wave
modprobe opl3 io=0x388

The cleaner way is to use the modules.conf arrangement (actually several configuration files that get automatically integrated into /etc/modules.conf):

  1. Add a line for each sound module to /etc/modules (note that the lines for other modules may already be there), for example: sb awe_wave opl3
  2. For each module that requires options, make a file of that name under /etc/modutils with a line for the options, for example:

    /etc/modutils/sb:
        options sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330
    /etc/modutils/opl3:
        options opl3 io=0x388
  3. Install this data in the master /etc/modules.conf file: update-modules This will ensure that the sound modules are properly loaded at every boot.

An easy way to accomplish all this is to use the modconf program, which is the same tool that runs during the installation. For an ISA PNP card, be sure to set up the PNP configuration first.

Testing 

  1. Verify correct installation: cat /dev/sndstat
  2. Test sound using the sample files sample.au and sample.midi: cat sample.au >/dev/audio Install playmidi using dselect and run; playmidi sample.midi

References 

The Linux Sound HOWTO
     http://www.linuxdoc.org/HOWTO/Sound-HOWTO.html
 Instructions for specific sound cards
     /usr/src/linux/Documentation/sound/

Last modified Tue, 27 Feb 2001 13:43:01 GMT Ted Ruegsegger

documented on: 2004.07.08