-->
Previous | Table of Contents | Next |
by Tim Parker
One of the limitations of the first few versions of Linux was its lack of support of sound cards, joysticks, and other multimedia input and output routines. The last few releases of Linux have seen a major change in this aspect, though, and now Linux can be as fully capable of multimedia as Windows 98 can. This chapter looks at how you can configure your Linux system for multimedia applications.
A sound card does more than play a few beeps and prerecorded sounds when you open windows, do something wrong, or close down your system. A sound card is ideal for playing games, where it can generate both music and sound effects. It can be used to record sounds and voice to a file, and play it back later. A sound card can let you play an audio CD in your CD-ROM player, so you can listen to music as you work. And a sound card can act as an interface to some devices, such as a CD-ROM or SCSI device chain.
All sound cards work digitally: They use discrete chunks of data to tell the sound card chips what tone to generate, how loud to make it, and other parameters that define sound. Sound cards can generate these chunks of data at different rates; the faster and with more detail they are generated, the better the sound seems to our ears. As an example, most CDs sample data at the rate of 44.1 thousand samples per second, with 16 bits used for each sample. If you work out the math, that means that in an hour there are about 600 megabytes of data to produce CD-quality sound. Many sound cards from a few years ago couldnt handle this amount of data. Instead, they used 8 bits of data per sample, and sampled at rates as low as 8 thousand samples per second. The difference between the two is clearly audible if you listen on a decent stereo, but harder to differentiate when you listen through small, cheap PC speakers.
Sound files today are available in a wide variety of formats. Each format differs in the sampling rate, the number of bits per sample, whether a compression algorithm is used, and the number of channels used (mono is one channel, stereo is two, and so on). The most common forms are summarized in Table 21.1.
File extension | Channels | Sample size | Sample rate | Comments |
---|---|---|---|---|
.au | 2 | 8 bit | 8 KHz | Sun UNIX format |
.mod | 2 | 8 bit | varies depending on algorithm | |
.raw | 2 | 8 bit | 22 KHz | |
.voc | 1 | 8 bit | 22KHz | |
.wav | 1 | 8 bit | 22KHz | |
.wav | 2 | 16 bit | 44KHz | |
A number of sound card drivers are included with current versions of Linux. These all have drivers for Linux written by owners of the cards, who are experienced with device driver programming and made the effort to support their cards. Kindly, they make the drivers available to everyone who uses Linux. (You cant use the drivers that came with your sound card because they are usually DOS- or Windows-specific, and the architecture of the operating systems is not interchangeable.) Even if you do not have a Linux driver for your specific card, it may be supported through a compatible card driver. For example, many sound cards are SoundBlaster-compatible, so a SoundBlaster driver may work (but then again, may not).
So you dont have a sound card yet. Youre not completely out of luck. A driver is available for the small speaker built into practically every PC box. While this may sound as though it wont be much good, the driver manages to elicit surprisingly good 16-bit stereo sound from the tiny device, allowing you to play games like Doom. If youre handy with wiring, you can also string a pair of wires to an external speaker instead of the internal, although you have to remember the amplifier on the motherboard is very low power. If you want to use the PC speaker driver, you have to download it because there are few versions of Linux that include it as part of the distribution.
Tip:
To obtain the latest version of the PC speaker driver for Linux, check the FTP site ftp.informatik.hu-berlin.de/pub/os/linux/hu-sound or one of the Linux FTP archives listed in Appendix A, Linux FTP Sites and Newsgroups. The most recent version of the driver when this chapter was written was 0.9.
Included with the PC speaker driver is a set of instructions that guide you through the installation and configuration procedure. A sample file included with the distribution package lets you test the speaker to make sure it is behaving properly.
Previous | Table of Contents | Next |