# Configuring Linux for Sound Support

Configuring Linux to support sound involves the following steps:

1. Installing the sound card.
2. Configuring and building the kernel for sound support.
3. Creating the device files.
4. Testing the installation.

### Installing the Sound Card

Follow the instructions provided with your sound card. Be sure to note down the jumper settings for IRQ, DMA channel, etc... If you are unsure, use the factory defaults. Try to avoid conflicts with other devices (e.g. ethernet cards, SCSI host adaptors) if possible.

### Configuring the Kernel

If you are using a recent kernel (0.99pl14 or later), the sound drivers are included with the kernel release. Follow the usual procedure for building the kernel. When you run `make config`, a configuration program will ask you what sound card options you want.

If you are upgrading from an older sound driver, make sure that the files `/usr/include/sys/soundcard.h` and `/usr/include/sys/ultrasound.h` are symbolic links to the corresponding files in `/usr/include/linux`.

It's good idea to read the `Readme` files in the kernel `drivers/sound` directory since there could be some last minute information. The file `CHANGELOG` contains a list of enhancements and new features since the previous version.

### Creating the Device Files

The first time the kernel sound driver is configured, you need to create the sound device files. The easiest way to do this is to cut the short shell script from the end of the file `Readme.linux` (or possibly `Readme`) in the directory `/usr/src/linux/drivers/sound`, and run it as root.

### Testing the Installation

You can now follow these steps to verify the sound hardware and software:

1. Reboot with the new kernel.

Follow your usual procedure for installing and rebooting the new kernel (keep the old kernel around in case of problems, of course).

2. Verify that the sound card is recognized during kernel initialization.

Check for a message such as the following on powerup:

> `

>     <6>snd2 <SoundBlaster Pro 3.2> at 0x220 irq 5 drq 1
>     <6>snd1 <Yamaha OPL-3 FM> at 0x388 irq 0 drq 0

> `

This should match your sound card type and jumper settings.

The driver may also display some error messages and warnings during boot. Watch for these when booting the first time after configuring the sound driver.

If no sound card is detected when booting, there are two possible reasons:

- The configuration of the driver is incorrect and the driver was not able to detect your card in the given I/O address, or
- The sound driver was configured to be inactive or you booted with an old kernel (a common error).

3. Check device file `/dev/sndstat`.

Reading the sound driver status device file should provide additional information on whether the sound card driver initialized properly. Sample output should look something like this:

> `

>     % cat /dev/sndstat

>     Sound Driver:2.5 (Wed Apr 20 19:57:25 EDT 1994 root@fizzbin)
>     Config options: 1aa2

>     HW config:
>     Type 2: SoundBlaster at 0x220 irq 5 drq 1
>     Type 1: AdLib at 0x388 irq 0 drq 0

>     PCM devices:
>     0: SoundBlaster Pro 3.2

>     Synth devices:
>     0: Yamaha OPL-3

>     Midi devices:
>     0: SoundBlaster

>     Mixer(s) installed

> `

If the cat command displays "No such device", the sound driver is not active in the kernel.

If the printout contains no devices (PCM, Synth or MIDI), your soundcard was not detected. Verify that the "HW config" section contains correct information.

4. Play a simple sound file.

Get hold of a sample sound file, and send it to the sound device as a basic check of sound output, e.g.

> `

>     % cat endoftheworld >/dev/dsp
>     % cat crash.au >/dev/audio

> `

Some sample sound files can be obtained from the file `snd-data-0.1.tar.Z`.

5. Verify sound recording.

If you have sound input capability, you can do a quick test of this using commands such as the following:

> `

>     # record 4 seconds of audio from microphone
>     % dd bs=8k count=4 </dev/audio >sample.au
>     # play back sound
>     % cat sample.au >/dev/audio

> `

If these tests pass, you can be reasonably confident that the sound hardware and software are working. If you experience problems, read the FAQ section of this document.