Home

An Introduction to Linux Sound Systems


Arvind Singh
arvind@ipr.res.in
 
 

When coding a program, one of the best ways to show users that an event has happened, is to produce sounds. That's why sound is now present in almost every program. Every operating system has different sound systems to access the sound card. Programmers have many different choices concerning which system to use, especially under Linux -- and may be that's the problem. This article will illustrate free sound architectures under Linux, as well as the different interfaces a programmer can use.  
 

Kernel sound drivers: OSS and ALSA

 

Linux has two systems for handling sound :

 
  • OSS  
     

    Open Sound System (OSS) comes in two versions: OSS/Free, which is a free version  by the well-known kernel hacker Alan Cox, and 4Front Technologies' OSS (OSS/Linux, formerly known as VoxWare, USS, and TASD), which is a proprietary implementation based on OSS/Free. OSS is available not only for Linux but also for BSD and other Unix systems. The drivers supplied with the Linux kernel source (the OSS drivers) are functional and work well with many sound cards; they are being maintained, but the original developers have gone on to form a company, 4Front Technologies, which supplies enhanced drivers (including drivers for cards which Linux doesn't support) to Linux users willing to pay for them. 4Front's drivers can be easier to set up than the native Linux drivers, and 4Front's developers attempt to keep abreast of new cards as they appear.

     
  • ALSA  
     
     

    Advanced Linux Sound Architecture (ALSA) is the new Linux sound hardware abstraction layer that replaces OSS. In fact, it's more than a simple HAL because it provides a user-space library named libasound. What's more, it's thread-safe, works well with SMP machines, and is backward-compatible with OSS/Free (using OSS emulation module). Of course, it's also free and open source. A full description of its features can be found on ALSA's Web site.

    Devotees of open-source software prefer open-source drivers, due to which the ALSA  project appeared on the scene. Rather than attempting to extend the current free Linux drivers, ALSA programmers started from scratch. Other developers began to contribute and the result has been a new modular driver system which has been useful for end-users for the past year or so. Several sound-card manufacturers have provided specifications to the ALSA programmers, enabling them to provide driver modules for previously unsupported cards.

     

    A basic sound toolkit:

     

    There are several command-line software packages which are both useful in their own right as well as for providing services to GUI sound software.

     
  • Sox  
     

    SoX is both a file-converter and an effects utility. It can convert just about any sound-file format to any other, as well as optionally processing the sound in many different ways. Effects include various filters as well as several "guitar effects" such as phaser, chorus, flanging, echos, and reverb. SoX also serves as a sound-file player. One such shell script, called play, is part of the SoX package; it supplies the options to the sox binary which enable it to be a sound-file playing utility. You may have already used it without knowing it was there, as many file managers call sox whenever a sound-file is double-clicked with a mouse.

     
  • mpg123  
     

    Though there are many flashy X Windows mp3 players out there, the humble command-line decoder/player mpg123 is still one of the fastest and most memory-efficient. Several of the GUI players call mpg123 to do the actual grunt work, while XMMS (formerly known as x11amp) now incorporates some of the mpg123 code internally rather than calling it as an external process. Like SoX, mpg123 has many command-line options. With these you can play an MP3 file in a great variety of ways, such as in mono, or at varying speeds. Mpg123 can also retrieve and play files directly from a web-site.

     
     

    Procedure for installation of sound card under redhat linux 7.3 or 8.0 or 9.0 for intel 865 Motherboard:

     
    1. Log into the system as the “root” user to compile and configure audio driver.
    2. Extract the compressed package using the following command:

    tar –zxvf realtek_alsa_audio_A1.80.tar.gz /root

    1. Now navigate to the directory that contains extracted audio package e.g.

    cd /root/alsa-driver-0.9.2

    1. From this directory, enter the following commands.

    ./configure –with-cards=intel8x0 –with-sequencer=yes

    1. Enter the following command

    make

    make install

    ./snddevices

    1. change to the “utils’ directory e.g. cd /root/ alsa-driver-0.9.2/utils
    2. Enter the command

    ./alsaconf

    This will launch the ALSA configuration utility

    1. Now select “OK” on all screens
    2. On the “Audio Solution Selection” screen, select the “snd-intel8x0” device
    3. Now exit the configuration utility and the settings will be automatically saved
    4. Reboot your system.  If the new H/W detection starts upon reboot, simply highlight “configure” and allow the system to continue rebooting. 
    5. Now enter the following commands

    modprobe soundcore

    modprobe snd-intel8x0

    modprobe snd-pcm-oss

    modprobe snd-mixer-oss

    modprobe snd-seq-oss

                             OR  
              Save these commands in cd /etc/rc.d/rc.local file

    1. Once the desktop is loaded, open the audio mixer and adjust the MASTER and PCM volume slider

    Acknowledgement: Material for this article has been derived from articles in the websites of ALSA and 4Front Technologies