Personally, I do not have anything against a quiet computer, but the rest of the world seems to disagree with me. Eventually I succombed to the environment around me, and made the effort to get my sound working. It proved to be quite easily done.
I want to know what else you feel may be missing in the information presented here. An e-mail is always welcome and encouraged.
You may already be capable of sound, especially if you have one of the newer distributions. Many distributions have sound modules included on a defualt installation so that you won't have to recompile the kernel. Chances are that your distribution does this, and if it does, you don't have to read the longer parts of this guide. After you're done here, skip on down to Sound Playing Programs.
If you have a recent version of the Red Hat Linux distribution, try to run the sndconfig program (as root). It could ask for sound card settings such as the I/O base address, IRQ, DMA, and 16-bit DMA. Be prepared to give them. It also calls isapnptools PnP card detection utility.
Try this command for any distribution closely related or, more commonly, based, on Red Hat Linux. (Mandrake comes to mind.)
TurboLinux users should use the turbosoundcfg utility. It could ask for sound card settings such as the I/O base address, IRQ, DMA, and 16-bit DMA. Be prepared to give them. It also calls isapnptools PnP card detection utility.
I think turbosoundcfg was based on Red Hat's utility anyway.
Jon Kax writes:
My version is Slackware 3.6, updated, not to 4.0 but for hand so it uses most of the libs,etc that 4.0 uses. I use kernel 2.0.35 because i have no need in 2.2 kernels, and in 2.0.35 for slackware 3.6, soundblaster 16 is precompiled as a module, thats why i dont need to recompile kernel with support (because i use a sb16-card. Because of this, all i have to do is to load the module, but for other cards than sound blaster you will need to recompile your kernel.
Please feel free to add the appropriate information to this section by dropping me a line.
If you know what sound configuration utility your distribution uses, please write in and let me know.
Otherwise, you're out of luck for now. Read the rest of this guide, or wait indefinitely until I update this page.
The kernel sources could probably already be installed in your /usr/src/linux directory. Go there using cd /usr/src/linux. If it doesn't exist, then you need to grab yourself a copy of the kernel sources. Follow the download instructions on another page, Compiling a New Kernel. That page delves deeper into the process of compiling a new kernel, also.
Get into kernel configuration using the make config or make menuconfig command. I prefer make menuconfig because it allows me to go back and check for any mistakes, unlike make config. If you want an X interface to configure your kernel's settings, you can also use make xconfig.
Once you're in, configure all the other stuff that you need to (according to Compiling a New Kernel, and then configure sound.
If you're using make menuconfig to configure your kernel, just scroll down to "Sound" with the arrow keys and then press [Enter]. It will probably say "Sound card support" and alongside that, a checkbox. While that's highlighted, just type in "y" (standing for "Yes") to enable it. Basically, the controls are typing "y" to include support for something in the kernel, typing "m" to make something a loadable module which is separate from the kernel, and "n" to disable support for something. The controls for this interface are explained near the top of the screen.
The configuration, no matter what you use, should ask you what type of card you have. Some that are listed include the Sound Blaster (various types... I have the SB16 PnP), the PAS16, the ESS soundcards, and other less-common cards. If your card is listed as Sound Blaster compatible you should enable support for the Sound Blaster. By default, none of these cards is supported (answered "Yes" to), so choose wisely, grasshopper. Also, only enable support for the card you need, if possible, because that will keep your kernel small and will prevent potential problems when the kernel tries to detect all the supported cards.
There are some other items that you may never have heard of, such as "Generic OPL2/OPL3 FM synthesizer support" or "6850 UART MIDI support". According to Claudine Langlois, "OPL2 / OPL3 is a standard made by Yamaha for MIDI files. It's in the chipset of the sound card and it helps to have a much much better sound when the program that reads the file knows how to use OPL2/OPL3. Believe me, it's worth to be heard. Of course, OPL3 is better than OPL2...". And for that 6850 UART MIDI stuff, "6850 is a standard for a FIFO buffer for the game port on a PC. MIDI support means to plug a synthetiser in the game port of the sound card. By the way, UART means Universal Asynchronous Receiver/Transmitter.". Thanks to Claudine and all the others who wrote in about this.
If there are options for them, enable support for /dev/audio and /dev/dsp. New kernels do not have options for these, because supporting them is automatic when one enables sound support. In make menuconfig this can be done by simply pressing "y" when "/dev/audio and /dev/dsp support" is highlighted.
More items you will probably want to enable are support for MIDI, FM synthesizer support, and /dev/sequencer support. If you don't have even a vague clue as to what these do, basically they're for playing files that have specific instructions to the machine to play certain sounds.
It's highly recommended that you write down or memorize the settings that your system is using. Most importantly, what I have in mind are the IRQ settings, the DMA channels, and the I/O base addresses. The kernel configuration will ask for this.
Use cat to print out the information about your system, such as the I/O base addresses (/proc/ioports), DMA channels (/proc/dma), IRQs (/proc/interrupts), and any devices you might be interested in (/proc/devices).
Now is the time to recompile the kernel. There's more information on how to compile a kernel located in this part of this Linux guide, but if you're already familiar with compiling a kernel, then it's safe for you to read on.
Basically after you type in make dep and make clean to make the depenencies and clean out the old junk from your last kernel compilation (if any), type in make zImage. This should compile the kernel. After you're taken back to the prompt then you should type make modules and then make modules_install to compile all the modules, which are these little itty bitty files that are loaded for something that was not directly compiled into the Linux kernel (a single file). Then copy the kernel to the appropriate place, which is /boot/vmlinuz if you're using Red Hat. Do this by typing in cp arch/i386/boot/zImage /boot/vmlinuz, assuming you're using Red Hat of course. (The kernel is /vmlinuz on Slackware. I don't know about other distributions.) If you use LILO to get into Linux, type lilo. If you use LOADLIN (loading DOS/Win95 first and then using it to boot a copy of your kernel), you need to copy the kernel (arch/i386/boot/zImage) to your DOS partition. Again, there's more information on this available right here.
Now, whatever you do to reload Linux totally, do it. In my case I would reboot. When your system spits out all its boot messages, here's what it should say about the soundcard:
Sound initialization started <Sound Blaster 16 (4.13)> at 0x220 irq 5 dma 1,7 <Sound Blaster 16> at 0x330 irq 5 dma 0 <Yamaha OPL3 FM> at 0x388 Sound initialization complete
Of course, it will look different if you have a different type of card. As long as you hear a little pop from the speakers or something, that means it was configured correctly.
My soundcard is PnP and it cost me a lot of frustration and experimentation. That's what you have to frequently do when using Linux. But on to the information you actually care about: how to fix it if it goes wrong for you.
If you think you followed the instructions on this page but get something similar to the following error message when you boot up, then it could be due to the PnP configuration. Here it is:
Sound initialization started Sound initialization complete
Along with error messages like that, you won't hear a pop made by the speakers, either. You probably configured everything right (you know, the IRQ, DMA, and I/O base address stuff), but the card is PnP and Linux doesn't like that (well, the stable kernel anyway). That's why you should set up your machine for PnP in the BIOS, if you can. Another method is with the isapnptools utility, which I haven't figured out yet. Information on it is available at http://www.roestock.demon.co.uk/isapnptools.
Basically all that I had to do in the BIOS to get the soundcard to work was to change a setting in the PnP configuration. I have an Award BIOS, and the option was "PnP OS Installed" and the answer was "Yes". All I had to do was change it to "No". The reason this worked, I'm guessing, is that the BIOS set up the PnP devices for me because it was told that there was no PnP-aware operating system installed. Before, it was on "Yes" so it just left the configuration of all the PnP devices (the soundcard included) up to Windows 95.
The above method should suit most people just fine. However, I also have an Ethernet card, and when I change those options in the BIOS, my Ethernet card (a jumperless one) refuses to communicate with the rest of the network. So, I have to load Windows 95 first, exit to DOS, and then boot Linux using LOADLIN and my kernel. The command line for Loadlin is loadlin kernel_file. Make sure that the kernel file you're using is one with support for sound. The kernel file I'm referring to is the actual kernel, which goes by the name of vmlinuz somewhere on your Linux filesystem (/boot/vmlinuz or /vmlinuz).
I leave the "PnP OS Installed" option to "Yes" when I want to boot into Windows 95 and then use Loadlin to load Linux. Windows sets up the soundcard and gets it working, and the Ethernet card works too. I exit from Windows by going to Start -> Shutdown and then choosing the option of "Restart in MS-DOS mode", which is just quitting Windows and going to DOS.
If I make the "PnP OS Installed" option to "No" and then try the Windows -> Linux loading method, my soundcard will still work, but my jumperless Ethernet card will not. So, I leave that option to "Yes" in the BIOS.
Most of the major Linux distributions (Red Hat, Slackware, Debian, and Caldera) come with utilities to play sound. I don't know about the less well-known distributions, but they probably include them also.
For .au formats, you don't even need to have a program installed for playing sound. All you have to have is the cat program and sound properly configured. At the prompt, you can type in cat soundfile.au > /dev/audio. That should work for .au formats only.
Personally, I use the program playmidi, which was already pre-installed on my Red Hat machine. If you didn't install that package for Red Hat, it's playmidi-*.rpm from your local Red Hat mirror or your Red Hat CD-ROM. I'm using a wildcard because I'm too lazy to find out what the current version is... plus, I won't have to update this document if a new version of playmidi comes out. :-)
Playmidi is also available from SunSITE. As I'm writing this, it's available from sunsite.unc.edu/pub/Linux/apps/sound/players/. The basic syntax is playmidi filename.mid.
There are several good MP3 players that I'm aware of now. The ones that I use often are XMMS (formerly X11AMP) and mpg123. There's also GQMpeg, which is a front-end to mpg123.
XMMS looks very similar to Winamp. You can even use Winamp skins for it. It supports playlists as well. As usual though, watch out for high system load that will cause your MP3 playing to skip.
You can download RealPlayer from RealNetworks. You can configure Netscape to use that as a plugin. The README included in the Linux version might have information on how to do that. If not, let me know that it doesn't.
Paul Winkle let me know about the play command. I checked, and it came with my Red Hat 5.1 distribution. It uses sox, which can also convert between audio formats and even do basic effects.
Dave Click wrote in to say that OPL3 is his soundcard... that kinda makes sense to me now, so if you've got the soundcard that he does, then you probably want to enable support for that also. Anyway, here's his message.
Just like to say I really like your page... i'm just getting started with linux and this is helping me out a lot. I have something to add, surprisingly... in section #9 - setting up sound, you mention: Generic OPL2/OPL3 FM synthesizer support OPL3 is my sound card - it's a Yamaha, and in Win95 that's my setting for how it plays Midi. I don't know if that helps... i don't know what opl stands for or anything...
Sybren Stuvel wrote:
I really like to contribute to your pool of Linux-info! Here's my addendum: I own a Creative Labs Soundblaster 16. These are the settings: PORT: 220 IRQ:5 DMA:1,5 Now for the problem: make menuconfig has a default IRQ 7. As you can see, mine is 5. The menu refuses to change the IRQ to 5!!! My solution: stick with the 7 for now. As you have configured the whole thing, close the menu, and edit the .config-file manually. This way you can set the IRQ to 5, and everything goes as planned!
Just leaving like that didn't work for me, but I have a strange system that has a lot of stuff that doesn't work without some extra configuration. He also wrote that doing a cat /dev/sndstat will show all the information about your soundcard.
If you have a weird mutant soundcard from some obscure company, take a look at this text file written by Aaron Kuhn. It was too long to include here and convert to nice HTML so I thought I'd leave it in its unmodified glory. :-)
Questions, comments, suggestions? This is currently in a development stage of Beta, which means it's not guaranteed to work yet but I'm pretty sure it will work. If it works for you, please let me know. My e-mail address is joshuago at users dot sourceforge dot net.
Copyright © 1997-1999 Joshua Go (joshuago at users dot sourceforge dot net). All rights reserved. Permission to use, distribute, and copy this document is hereby granted. You may modify this document as long as credit to me is given.