Living without Windows!

by Jos Visser

Part 11: Sound Works (sort of)!

Go back to the index


Amongst its many features, my brand new Jadzia laptop contains a sound card, speakers, a microphone and a CD player. Although audio capability obviously is not required for my average business use, it is surely fun to be able to play sounds and listen to audio CD's. When installing and configuring Linux on the new Jadzia I initially left the audio card aside as something to fuss over when the really important stuff was working.

Well, all the important stuff was working, so time for some leisure! On a not quite so sunny Sunday morning I started out to configure my sound system.

First attempt

Knowing that the new Jadzia had sound support, I had taken care to select a bunch of sound tools to be able to mix input sources and to play audio files and CD's. Starting these in the plain vanilla system built by the installation procedure does not work very well. As you'd probably expect, no sound is produced at all. One of these tools is "xmcd": a program to play audio CD's from the computer's CD-ROM drive. I remembered from other PC sound cards that I installed that there should be a direct connection between the CD-ROM drive and the speakers. If I was lukcy, this might imply that I would be able to play an audio CD without any additional configuration! I started "xmcd" but it immediately complained that there was no CD-ROM drive configured for audio CD playback. Hmm, so this program probably needs its own specific CD-ROM drive configuration.

After some perusal of the "xmcd" manual page I found a reference to the "/usr/X11R6/lib/X11/xmcd" directory where important configuration information was stored. I changed to this directory and found (amongst other things) a "config" subdirectory which contained a "" shell script. Obviously a shell script of this name calls for immediate execution without any further research :-). "" proved to be a pretty straightforward and simple configuration program. The only real information it needed from me was the type of CD player ("Generic non-SCSI" worked fine) and the device file name of the CD-ROM drive ("/dev/hdc"). It then wrote a configuration file with all this information back into its "config" directory.

When I subsequently started "xmcd" it recognised the audio CD I had inserted in the drive, it even started playing it, but alas, no sound came from the internal speakers. Even when I hooked up a headphone set to Jadzia everything remained silent. So, no free lunch here either :-(. I really had to sit down and configure the sound card before any meaningful sound would come out.

Second attempt: a sound kernel (pun intended)

To be able to use sound in Linux you have to configure and compile a sound driver in the Linux kernel. I could vaguely remember that when creating a Linux kernel configuration one of the questions asked is whether or not to include sound support in the kernel. Up until now I had always answered "No" to this question. Obviously the first step one should take is to build a kernel with sound support. I changed into the "/usr/src/linux" directory and executed "make config". Fortunately, the command line configuration process remembers your previous settings and uses them as defaults in any new configuration dialog, so I could just "Enter" through all the questions until I got at the sound support section. There, the configuration programs aks questions like the type of sound card you have and its I/O parameters such as the I/O address, the IRQ number and DMA lines it uses.

To be honest, I did not have the foggiest idea what these were. Apart from the sound card that is, the manual clearly stated that it was Soundblaster Pro compatible. I selected a soundblaster card and went for the default configuration options (I/O 0x220, IRQ7, DMA 0,1). The "make config" wrote a set of configuration files and ended. I then executed a "make install" to create a new kernel and immediately install it in the root directory of the root file system. This takes time, ........ but once finished I rebooted the system.

The system came up like a charm. Almost all hardware devices announce themselves at system reboot. However, nn my new Jadzia, these messages scroll by faster than even I can read them. Henceforth I was not really able to pick up any messages related to the availability of the sound system. However, once logged on, you can always look at these kernel initialisation messages using the "dmesg" command. When I did so I unfortunately read some messages about how the Soundblaster driver had been unable to validate the card's configured IRQ (7). The driver was there, but did not recognise the sound card!

Well, this was what I had been afraid off! Now I probably had to get into the nitty gritty details of sound card configuration!

Third attempt

My desktop computer Belana happens to contain a Soundblaster 16 card, and from that setup the base I/O address 0x220 looked awfully familiar to me, but I could remember that Belana used another IRQ. I rebuilt the kernel, but now configured the Soundblaster IRQ on IRQ5. I performed a reboot to start the new kernel. Alas still no success.

Fourth attempt

Well, what is a person to do next? I decided to build a DOS boot flop and reboot to DOS in order to run the official Soundblaster configuration and test programs that had come with Belana's SB16 card some years ago. Rebooting to DOS was no problem at all, albeit a bit heart wrenching. The "SBCONFIG.EXE" program verified that the base I/O address (0x220) was correct, but whichever IRQ number I tried, (the config program allows 2, 5, 7 and 10), the program complained that it could not verify the IRQ number. The "SB16TEST.EXE" program (also part of the official Creative Labs set) complained just as hard. The only light at the end of the tunnel was that it did correctly recognize the sound card's synthesizer at I/O address 0x388 and it could play some music through it! But on the whole, the audio card still proved resilient to my efforts to get it to work.

Fifth attempt

Knowing that the base I/O address was correct I decided to try every possible IRQ in the system that was not already allocated to some other device. A "cat /proc/interrupts" tells you which interrupts are currently taken and I went into a loop of building kernels with the sound card configured for every free IRQ and rebooting the system with them. None of the kernels worked. I was getting a bit desperate.

Sixth attempt

When I had first unpacked the new laptop, one of the small items I found in the box was a CD-ROM containing drivers for the various devices in the system. I then correctly assumed that these would probably be for DOS, Windows and OS/2 only, so absolutely no good to me. However, by now I was getting pretty desperate and I decided to try the DOS drivers for the sound card so that I might get a glimpse of its configuration. I booted the system using a DOS floppy (with a DOS CD-ROM driver!) and changed into the DOS/Windows drivers directory on the CD. I started the "SETUP.EXE" program, but to my disappointment this setup program had to run under Windows 3.1. Given the way the laptop was partitioned, installing a temporary Windows was not possible any more. This avenue looked pretty closed as well.

By new, I was solidly desperate, and I decided to quit trying to configure the sound for now.

Seventh attempt

Next Tuesday I met my collegue Martijn and I asked him whether he had any good ideas. We discussed the various possibilities together and he came up with the notion that the sound card was probably "Plug and Pr^Hlay" (PnP) and needed to be configured first before it could be used. Unfortunately, Jadzia's BIOS does not allow pre-configuration of PnP devices so it was up to a Linux program or driver to perform the initialisation. Martijn then found a bunch of programs that could come in handy: "pnpdump", "isapnp" (both part of the "isapnptools" package) and "scanports". "pnpdump" runs through the system, dumps a list of all the unconfigured PnP devices and suggests configurations (I/O addresses, IRQ and DMA) for them. Taking "pnpdump"'s advice, "isapnp" can then configure the PnP cards and assign addresses and IRQ's to hem. Another utility, "scanports", does a scan of the system I/O space and tells you which I/O addresses are used by what cards.

We downloaded, compiled and executed these programs. "pnpdump" found the sound card allright, and using some creative vi-ing we hacked together an "isapnp" configuration file for the card. Following this, we used "isapnp" to assign the configuration to the card and crossed our gingers. We hadn't dare hope that this would do the trick, and as to reward our unbelief, the sound card stayed quiet. We messed about for a while, but to no avail.

Desperate is not the correct word for how I felt then......


On Wednesday I attended a board meeting of the NLUUG. Normally these meetings are held at various business locations. However, for this occasion, my NLUUG colleague Jan Christiaan van de Winkel proposed to hold the meeting at his house in Driebergen, followed by a copious Danish christmas lunch (he is from Danish ancestry you see). As you can imagine, there was not much resistance to this idea, so on Wednesday 16th of December the entire board travelled to Driebergen. We had a fruitful meeting where we decided on things like the future of the SANE conference (we are investigating the possibilities of SANE 2000) and made some progress on the future course of the NLUUG news letter. Following the meeting we were feasted on an awesome lunch with salmon, roast beef, caviar, prawns, champagne and akvavit. My sound card problems had a somewhat lower priority that day :-)

The 2^3 attempt

As any computer scientist knows, all good things come in powers of 2.

On Thursday I went to a customer where I am doing extensive UNIX evangelisation (and some UNIX/Internet/Java consultancy :-). I explained my sound card problems to a bunch of recent converts and to my surprise they immediately came up with (what would prove to be) the correct answer: the Linux Open Sound System (OSS, see I visited the OpenSound web site and it turned out that these were a bunch of guys who had written a comprehensive sound support system for various flavours of UNIX (Linux, FreeBSD, BSDI, AIX, SCO, QNX and so forth) that they sold for $20,=. Their web site contains an impressive list of sound devices that they support and I saw that mine was on the list (a Yamaha YMF715 PnP).

You can download the OSS software and try it out. If you're content, you buy a license and install it. The unlicensed software contains all the features, but is time limited (it only runs for a small amount of time and then automatically stops). The installation program automatically starts the OSS configuration program, which flawlessly recognised my sound card. I executed the "soundon" command which immediately announced that the sound hardware was available. I was thrilled! This was going very easy! I searched for a WAV file and played it using the "wavplay" command. I burst out in a shout of joy when sound flowed out of the laptop's tiny speakers! Hurrah!

The xmcd CD playerNext I borrowed an audio CD from one of my co-workers (Frank Katsburg of CMG) as he happened to have Emma Shapplin "Carmine Meo" with him. I inserted the CD in Jadzia's drive, started the "xmcd" program and fast forwarded to my favorite track on the CD: "Favola Breve" (track 6). Again, sound flowed from the speakers, leading to even more shouts of excitement. I immediately decided that this software was well worth $20,=: I connected to the OSS web site, filled out the order forms and submitted them. The license file appeared in my e-mail inbox almost instantanously and I installed it through the configuration utility.

Next, I modified the Linux boot procedures to automatically execute a "soundon" at boot and a "soundsoff" at shutdown so that the sound system would be available in every session.

Small problems

So now the sound system is working. I have however since then experienced a small problem in that the sound system suddenly stops working after one or two hours. I e-mailed a description of this problem to the OSS tech support and I am currently engaged in a discussion with them about causes and solutions for this problem (they responded quite rapidly to the e-mail). As a temporary fix, I wrote a small script called "soundbounce" that stops and starts the sound system (using "soundoff" and "soundon"). I execute "soundbounce" every hour through "cron".

True, this is not very elegant, but it works flawlessly. I find this a very powerful aspect about UNIX: given that software is bound to contain bugs, I truly cherish an operating system that gives me all the tools to quickly work around these problems in order to get a working system.

Last change: 19th December 1998 by me