Before I began the software aspects of the installation and configuration, I first installed the SoundBlaster 128 PCI card inside my computer. This was fairly painless, and only took a few minutes to perform. After installing the sound card in an available PCI slot, I restarted my machine.
From what I read on various web sites (like the Linux Sound HOWTO), and through a couple of deja.com searches, I had three choices in the type of sound driver to choose from:
- The original, native Linux sound drivers. These enable the basic /dev/ devices to support basic sound. They've been around a while, and quite a few sound cards are supported. However, from the various comments that I gathered, these were somewhat obsolete, to be replaced with a new sound infrastructure sometime soon (see below).
- OSS - Open Sound System. There are a few of these drivers available in the Linux 2.2.14 kernel, as well as a bunch of commercial drivers available from 4Front Technologies.
- ALSA - Advanced Linux Sound Architecture. These drivers are API compatible with the OSS driver API, so applications written to conform with the OSS API should work with ALSA. In addition, all of the ALSA drivers are GPL'd. I read somewhere that ALSA will become the future sound infrastructure of the Linux kernel, but I could not confirm this. The ALSA drivers also seem to be under fairly active development.
My first attempt was to download and install the commercial OSS drivers from 4Front. Although I was successful in getting these to work, I was disappointed by the lack of open source and what I perceived as poor sound output quality. This may have just been my lack of skills, so YMMV.
So off I went to ALSA-Project. Upon reading the excellent documentation that is available there (see the ALSA-HOWTO), I learned that in order for ALSA to work with Linux 2.2.14, I had to make some changes to my Linux kernel.
The HOWTO states that in order for ALSA v0.5.3 to work on Linux 2.2.* kernels, the kernel must be:
- Configured with 'Sound Card Support' turned on as either a module or built into the kernel.
- No other sound drivers compiled into the kernel.
Note: The following instructions assume that the Linux 2.2.14 source distribution is installed in /usr/src/linux-2.2.14. So as user 'root', I did this:
cd /usr/src/linux-2.2.14
make xconfig
When the main menu appeared, I clicked on the 'Sound' button. The first item at the top of the Sound menu is 'Sound Card Support'. I clicked the 'M' radio button to build this as a module. I then verified that none of the other options on the sound menu we enabled with 'Y' or 'M'. I then pressed the 'Main Menu' button, and back at the main menu I pressed the 'Save and Exit' button.
Of course now that I've changed my kernel configuration, I had to rebuild my kernel. For reference, you should read the Kernel HOWTO. If you have never installed and configured a Linux source distribution, see the beginning of my article on setting up CDRW for some pointers. Here is a synopsis of what I do (as user 'root') when I re-build my kernel using the Linux 2.2.14 sources:
cd /usr/src/linux-2.2.14
make dep ; make bzImage ; make modules ; make modules_install
Once this procedure completes, you need to copy the kernel to the right directory:
cp /usr/src/linux-2.2.14/arch/i386/boot/bzImage /boot/vmlinuz-2.2.14-alsa
I chose the name vmlinuz-2.2.14-alsa as the name of the new kernel, but this is just my preference. Next, you have to make sure that you reconfigure lilo to load this new kernel by default when you reboot. The top of my /etc/lilo.conf file looks like this now:
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/vmlinuz-2.2.14-alsa
label=linux
root=/dev/hda8
read-only
Remember to make sure there are no other label=linux lines in your lilo.conf before you save your changes. If there are, lilo will complain. After editing the /etc/lilo.conf file, I then as root run the command lilo which forces lilo to parse the configuration file and rebuild the /boot/map file. Just to make sure everything is in order, I then usually do (still, as user 'root'), the following:
cp /usr/src/linux-2.2.14/System.map /boot/System.map-2.2.14-alsa
cd /boot/
rm System.map
ln -s System.map-2.2.14-alsa System.map
With these items in place, I then reboot my computer with the command:
shutdown -r now
Everything comes back up just fine, fortunately. At this point, the kernel should be completely configured for ALSA. The next step is to download, unpack, compile, and install the ALSA software. Again, I returned to alsa-project.org from where I downloaded the following packages into my home dir:
- alsa-driver-0.5.3.tar.bz2
- alsa-lib-0.5.3.tar.bz2
- alsa-utils-0.5.3.tar.bz2
Fortunately, I did have the bunzip package installed. If you don't (type:
which bunzip2 on the command line. If it doesn't show you a pathname to bunzip2, you don't have it), you can get it here. From my home directory where I saved the download files, I did a bunzip alsa*to unpack the .tar.bz2 files. Running bunzip2 on the files left me with three .tar files which I extracted with the commands:
tar xf alsa-driver-0.5.3.tar
tar xf alsa-lib-0.5.3.tar
tar xf alsa-utils-0.5.3.tar
Before you start to build the executables, you should make sure that your Linux 2.2.14 source files can be located by the build scripts. On RedHat, this is done by creating a symbolic link from /usr/src/linux to /usr/src/linux-2.2.14. The commands would look something like this (as 'root'):
cd /usr/src
rm linux
ln -s linux-2.2.14 linux
With the three archives extracted, I then built and installed the three packages as described in the ALSA HOWTO. From the command line, this amounts to the following, which I ran as user 'root' (Note: The order is important):
cd /home/jason/alsa-driver-0.5.3/
./configure ; make ; make install
cd /home/jason/alsa-lib-0.5.3/
./configure ; make ; make install
cd /home/jason/alsa-utils-0.5.3/
./configure ; make ; make install
Then, according to the ALSA HOWTO, I ran the script (as 'root') to create all the proper entries in /dev/:
cd /home/jason/alsa-driver-0.5.3/
./snddevices
With all the packages built, and the /dev file system all ready to go, I then told the kernel to load the modules that make sound work. The first module is the driver for my sound card, the second one provides the OSS compatibility layer. (again as 'root'):
modprobe snd-card-ens1371
modprobe snd-pcm-oss
After you do this, you should execute the lsmod command to make sure that everything loaded as expected. The output should look something like this:
Module Size Used by
snd-pcm-oss 16240 1
snd-pcm-plugin 12744 0 [snd-pcm-oss]
snd-mixer-oss 3860 0 [snd-pcm-oss]
snd-card-ens1371 1932 1
snd-ens1371 9788 0 [snd-card-ens1371]
snd-pcm 28312 0 [snd-pcm-oss snd-pcm-plugin snd-ens1371]
snd-timer 8544 0 [snd-pcm]
snd-rawmidi 9880 0 [snd-ens1371]
snd-seq-device 3004 0 [snd-rawmidi]
snd-ac97-codec 22816 0 [snd-ens1371]
snd-mixer 22832 0 [snd-mixer-oss snd-ens1371 snd-ac97-codec]
snd 3098 1 [snd-pcm-oss snd-pcm-plugin snd-mixer-oss snd-card-ens1371 snd-ens1371 snd-pcm snd-timer snd-rawmidi snd-seq-device snd-ac97-codec snd-mixer]
soundcore 2340 5 [snd]
If you're output does not contain at least the snd, soundcore, snd-card-ens1371, snd-pcm-oss items, then something didn't load. Here is a snippet from my /etc/conf.modules file that you can look over to help you get this working:
depfile=/lib/modules/`uname -r`/modules.dep
path=/lib/modules/`uname -r`
## Stuff added for ALSA sound!
alias char-major-14 snd-card-ens1371
alias snd-minor-oss-0 snd-card-ens1371
alias snd-minor-oss-3 snd-pcm-oss
alias snd-minor-oss-4 snd-pcm-oss
alias snd-minor-oss-5 snd-pcm-oss
alias snd-minor-oss-12 snd-pcm-oss
alias snd-card-0 snd-card-ens1371
If you do modify your /etc/modules.conf file, remember to do a depmod -a to rebuild the modules.dep file.
Another change that you might want to make is to change your system's startup scripts to load the basic kernel sound modules at boot time so that you don't have to remember yourself. I edited the file /etc/rc.d/rc.local and added the following to the end of the file:
modprobe soundcore
modprobe snd
modprobe snd-mixer
modprobe snd-pcm
modprobe snd-ens1371
modprobe snd-card-ens1371
The last item, again taken from the ALSA HOWTO, is to unmute the new sound devices by using the following commands:
amixer set Master 15 unmute
amixer set PCM 15 unmute
With everything configured, I now needed some apps to test out my new gear. After surfing the ALSA site, as well as freshmeat.net, I decided I would try xmms, which I obtained from here. You'll notice that xmms uses the OSS API, but since ALSA provides backwards compatibility for the OSS API, it works quite well. Those of you familiar with WinAmp will be very comfortable with xmms.
To finish off my evening of fun, I ended up installing the following set of applications:
- AlsaPlayer v099.31: An audio player (MP3, as well as other formats) that uses the ALSA sound API to communicate with your sound hardware. It works well, and even has playlists. However, it is lacking many of the nicer features of xmms (see above).
- gamix v1.09p9: A mixer (like the Windows Volume Control Panel) that allows you to mute/unmute sound types, as well as adjust their volumes. This one uses the ALSA API, and seems to work quite well. The author's site is entirely Japanese, but you can install it with the usual
./configure ; make ; make installjust fine.