The Linux Sound HOWTO Jeff Tranter tranter@pobox.com v1.22, 16 July 2001 Revision History Revision 1.22 Relicensed under the GFDL. Revision 1.21 2001−07−16 Revised by: jjt 2001−05−11 Revised by: jjt This document describes sound support for Linux. It lists the supported sound hardware, describes how to configure the kernel drivers, and answers frequently asked questions.
The Linux Sound HOWTO Table of Contents 1. Introduction.....................................................................................................................................................1 1.1. Acknowledgments.............................................................................................................................1 1.2. New versions of this document.........................................................................................................1 1.3. Feedback....
The Linux Sound HOWTO Table of Contents 6.11. There are pauses when playing MOD files...................................................................................20 6.12. Compile errors when compiling sound applications.....................................................................20 6.13. SEGV when running sound binaries that worked previously.......................................................21 6.14. What known bugs or limitations are there in the sound driver?............................
1. Introduction This is the Linux Sound HOWTO. It is intended as a quick reference covering everything you need to know to install and configure sound support under Linux. Frequently asked questions about sound under Linux are answered, and references are given to some other sources of information on a variety of topics related to computer generated sound and music. The scope is limited to the aspects of sound cards pertaining to Linux.
The Linux Sound HOWTO Most translations of this and other Linux HOWTOs can also be found at http://www.ibiblio.org/pub/Linux/docs/HOWTO/translations/. If you make a translation of this document into another language, let me know and I'll include a reference to it here. 1.3. Feedback I rely on you, the reader, to make this HOWTO useful. If you have any suggestions, corrections, or comments, please send them to me, tranter@pobox.com, and I will try to incorporate them in the next revision.
2. Sound Card Technology This section gives a very cursory overview of computer audio technology, in order to help you understand the concepts used later in the document. You should consult a book on digital audio or digital signal processing in order to learn more. Sound is an analog property; it can take on any value over a continuous range. Computers are digital; they like to work with discrete values.
3. Supported Hardware This section lists the sound cards and interfaces that are currently supported under Linux. The information here is based on the latest Linux kernel, which at time of writing was version 2.4.4. This document only applies to the sound drivers included with the standard Linux kernel source distribution. There are other sound drivers available for Linux (see the later section entitled Alternate Sound Drivers).
The Linux Sound HOWTO software. The majority of sound cards manufactured today now use PCI. Most motherboards that provide on−board sound hardware also make use of the PCI bus. USB is a newer bus architecture for external hot−pluggable devices. In theory USB bus sound cards could be developed, but I am only aware of USB−bus speakers being sold currently. 3.3. Sound Cards The following sound cards are supported by the Linux kernel sound driver.
The Linux Sound HOWTO Personal Sound System (PSS) Pinnacle MultiSound Power Mac onboard sound Pro Audio Spectrum 16 Pro Audio Studio 16 Pro Sonic 16 Q40 onboard sound Roland MPU−401 MIDI interface S3 SonicVibes SGI Visual Workstation SM Games SY−1816 SoundBlaster 1.0 SoundBlaster 16 SoundBlaster 16ASP SoundBlaster 2.
The Linux Sound HOWTO 3.4.1. OSS/4Front Sound support in the Linux kernel was originally written by Hannu Savolainen. Hannu then went on to develop the Open Sound system, a commercial set of sound drivers sold by 4Front Technologies that is supported on a number of Unix systems. Red Hat Software sponsored Alan Cox to enhance the kernel sound drivers to make them fully modular. Various other people also contributed bug fixes and developed additional drivers for new sound cards.
The Linux Sound HOWTO A device driver for true Roland MPU−401 compatible MIDI interfaces (including Roland SCC−1 and RAP−10/ATW−10). Comes with a useful collection of utilities including a Standard MIDI File player and recorder. Numerous improvements have been made since version 0.11a. Among other things, the driver now features IRQ sharing policy and complies with the new kernel module interface. Metronome functionality, possibility for synchronizing e.g.
4. Installation Configuring Linux to support sound involves the following steps: 1. Installing the sound card. 2. Configuring Plug and Play (if applicable). 3. Configuring and building the kernel for sound support. 4. Creating the device files. 5. Booting the Linux kernel and testing the installation. Some Linux distributions provide a sound driver configuration utility that will detect your sound card and set up all of the necessary configuration files to load the appropriate sound drivers for your card.
The Linux Sound HOWTO uncomment the appropriate lines in /etc/isapnp.conf. Don't forget to uncomment the (ACT Y) command near the end. • Make sure that isapnp is run when your system boots up, normally done by one of the startup scripts. Reboot your system or run isapnp manually. If for some reason you cannot or do not wish to use the isapnp tools, there are a couple of other options.
The Linux Sound HOWTO each option is for. Select the appropriate options to the best of your knowledge. After configuring the options you should compile and install the new kernel as per the Kernel HOWTO. 4.4. Creating the Device Files For proper operation, device file entries must be created for the sound devices. These are normally created for you during installation of your Linux system. A quick check can be made using the command listed below.
The Linux Sound HOWTO Previous versions of this HOWTO suggested checking the output of /dev/sndstat. This is no longer supported in the 2.4 and later kernels. Now you should be ready to play a simple sound file. Get hold of a sound sample 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 (Make sure you don't omit the ">" in the commands above).
The Linux Sound HOWTO the next stage. 4.6.1. Step 1: Make sure you are really running the kernel you compiled. You can check the date stamp on the kernel to see if you are running the one that you compiled with sound support. You can do this with the uname command: % uname −a Linux fizzbin 2.2.4 #1 Tue Mar 23 11:23:21 EST 1999 i586 unknown or by displaying the file /proc/version: % cat /proc/version Linux version 2.2.4 (root@fizzbin) (gcc version 2.7.2.
The Linux Sound HOWTO If your sound card was not found then something is wrong. Make sure it really is installed. If the sound card works under DOS then you can be reasonably confident that the hardware is working, so it is likely a problem with the kernel configuration. Either you configured your sound card as the wrong type or wrong parameters, or your sound card is not compatible with any of the Linux kernel sound card drivers.
5. Applications Supporting Sound I give here a sample of the types of applications that you likely want if you have a sound card under Linux. You can check the Linux Software Map, Internet archive sites, and/or files on your Linux CD−ROM for more up to date information. If you are running a graphical desktop such as KDE or GNOME then it should already include a number of multimedia applications that are integrated with your desktop.
6. Answers To Frequently Asked Questions This section answers some of the questions that have been commonly asked on the Usenet news groups and mailing lists. Answers to more questions can also be found at the OSS sound driver web page. 6.1. What are the various sound device files? These are the most standard device file names, some Linux distributions may use slightly different names.
The Linux Sound HOWTO /dev/music high−level sequencer interface /dev/sequencer low level MIDI, FM, and GUS access /dev/sequencer2 normally a link to /dev/music /dev/midi00 1st raw MIDI port /dev/midi01 2nd raw MIDI port /dev/midi02 3rd raw MIDI port /dev/midi03 4th raw MIDI port /dev/sndstat displays sound driver status when read (also available as /proc/sound, removed in 2.
The Linux Sound HOWTO Sun workstation (.au) sound files can be played by sending them to the /dev/audio device. Raw samples can be sent to /dev/dsp. This will generally give poor results though, and using a program such as play is preferable, as it will recognize most file types and set the sound card to the correct sampling rate, etc. If you are running a graphical desktop such as KDE or GNOME then it should already include a graphical sound file player program.
The Linux Sound HOWTO • AudioTrix Pro (hardware limitation) • CS4232 (hardware limitation) 6.5. Error: No such file or directory for sound devices You need to create the sound driver device files. See the section on creating device files. If you do have the device files, ensure that they have the correct major and minor device numbers (some older CD−ROM distributions of Linux may not create the correct device files during installation). 6.6.
The Linux Sound HOWTO Under the KDE desktop, the artsd sound server usually take control of the sound device. Applications should make requests to play sound through the sound server, or the sound server should be paused. A similar situation exists under GNOME with the esd sound server. 6.9.
The Linux Sound HOWTO 6.13. SEGV when running sound binaries that worked previously This is probably the same problem described in the previous question. 6.14. What known bugs or limitations are there in the sound driver? See the files included with the sound driver kernel source. 6.15. Where are the sound driver ioctls() etc. documented? Currently the best documentation, other than the source code, is available at the 4Front Technologies web site, http://www.opensound.com.
The Linux Sound HOWTO 6.17. Problems with a PAS16 and an Adaptec 1542 SCSI host adaptor (the following explanation was supplied by seeker@indirect.com) Linux only recognizes the 1542 at address 330 (default) or 334, and the PAS only allows the MPU−401 emulation at 330. Even when you disable the MPU−401 under software, something still wants to conflict with the 1542 if it's at its preferred default address. Moving the 1542 to 334 makes everyone happy.
The Linux Sound HOWTO 6.19. My SB16 is set to IRQ 2, but configure does not allow this value. On '286 and later machines, the IRQ 2 interrupt is cascaded to the second interrupt controller. It is equivalent to IRQ 9. 6.20. If I run Linux, then boot DOS, I get errors and/or sound applications do not work properly. This happens after a soft reboot to DOS. Sometimes the error message misleadingly refers to a bad CONFIG.SYS file. Most of the current sound cards have software programmable IRQ and DMA settings.
The Linux Sound HOWTO Philipp Braunbeck reported that on his ESS−1868 sound card there was a jumper to turn off the built−in amplifier which helped reduce noise when enabled. On one 386 system I found that the kernel command line option no−hlt reduced the noise level. This tells the kernel not to use the halt instruction when running the idle process loop. You can try this manually when booting, or set it up using the command append="no−hlt" in your LILO configuration file.
The Linux Sound HOWTO 6.26. Where can I find sound applications for Linux? Here are some good archive sites to search for Linux specific sound applications: • ftp://www.ibiblio.org/pub/Linux/kernel/sound/ • ftp://www.ibiblio.org/pub/Linux/apps/sound/ • ftp://tsx−11.mit.edu/pub/linux/packages/sound/> • ftp://nic.funet.fi/pub/Linux/util/sound/ • ftp://nic.funet.fi/pub/Linux/xtra/snd−kit/ • ftp://nic.funet.fi/pub/Linux/ALPHA/sound/ Also see the References section of this document. 6.27.
The Linux Sound HOWTO For more information see the 4Front Technologies web page at http://www.opensound.com/. I wrote a review of OSS/Linux in the June 1997 issue of Linux Journal. 6.30. Sox/Play/Vplay reports "invalid block size 1024" A change to the sound driver in version 1.3.67 broke some sound player programs which (incorrectly) checked that the result from the SNDCTL_DSP_GETBLKSIZE ioctl was greater than 4096.
The Linux Sound HOWTO Information on how to use the mwave sound card on an IBM ThinkPad laptop computer can be found in the file /usr/src/linux/Documentation/sound/mwave, which is part of the kernel source distribution (note that not all IBM ThinkPads use the MWAVE sound chip). 6.34. Applications fail because my sound card has no mixer Some old 8−bit SoundBlaster cards have no mixer circuitry. Some sound applications insist on being able to open the mixer device, and fail with these cards.
The Linux Sound HOWTO { a=read(fil, b, 256); write(fil, b, a); } } 6.37. Problems with IRQ 15 and Ensoniq PCI 128 From Matthew Inger (mattinger@mindless.com): Information on getting an Ensoniq PCI 128 card to work. The problem that it was exhibiting was that it was trying to use interrupt 15 by default (Plug and Pray was responsible for this one). This interrupt is used by the secondary ide controller, and cannot be shared by other devices.
The Linux Sound HOWTO downloaded from ftp://archive.cs.umbc.edu/pub/midia/instruments.tar.gz. 6.37.
7. References If you have a sound card that supports a CD−ROM or SCSI interface, the Linux SCSI HOWTO and the Linux CD−ROM HOWTO have additional information that may be useful to you. The Sound Playing HOWTO describes how to play various types of sound and music files under Linux. The Linux SoundBlaster AWE32/64 Mini−HOWTO describes how to get a SoundBlaster 32 or 64 card working under Linux. Programming information is available from the 4Front Technologies web site at http://www.opensound.com/pguide.
The Linux Sound HOWTO The Linux Documentation Project has produced several books on Linux, including Linux Installation and Getting Started. These are freely available by anonymous FTP from major Linux archive sites or can be purchased in hardcopy format. Finally, a shameless plug: If you want to learn a lot more about multimedia under Linux (especially CD−ROM and sound card applications and programming), check out my book Linux Multimedia Guide, ISBN 1−56592−219−0, published by O'Reilly and Associates.