|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Sunday, 9 April 2000||Author: Rowin Warin Andruscavage|
|Published to: enhance_articles_multimedia/Audio Articles||Page: 1/1 - [Std View]|
ESD: An Introduction
ESD is a software audio mixer daemon that allows you to play several sounds simultaneously on your computer. This article serves as an introduction to how it works.
Installation and Configuration Since ESD merely sits between your audio applications and /dev/dsp, it needs to run on top of OSS or ALSA drivers. Therefore, if your sound already works, you are ready to start using ESD. You can get the most recent version of ESD from the GNOME project. Once you have it compiled and installed, simply run ESD to fire it up. It will greet you with an arpeggio of test tones, which gives some indication of the sampling rate and whether the device is in stereo or mono mode. Newer versions can be configured to start automatically when it receives a connection from an ESD (app. esd -h will show you the configuration options available). You will probably want to open the audio device in the same mode as most of your applications in order to minimize the resampling ESD would have to do. If playing mp3 music, this means 44100 kHz and 16-bit stereo - the default for most current sound cards. ESD doesn't currently support higher bit rates, but 16 bits per sample is more than adequate relative to the line noise produced by most audio hardware.
Current Capabilities ESD provides quick software audio mixing to your current OSS or ALSA sound devices. Applications which support Esound will connect to the Daemon and feed it audio streams. Since ESD can listen for connections over TCP/IP ports, it will also allow input streams from remote hosts over a fast enough network, thus giving you a form of network audio. Programs that do not natively support Esound will complain about not being able to access /dev/dsp. ESD provides two forms of backward compatibility. The first is through dsp emulation, using the esddsp wrapper. Many applications such as vmware, wine, and older versions of mpg123 will work by simply prepending the wrapper to the command line: esddsp mpg123 music.mp3 . Unfortunately, some programs (such as rvplayer, quake, and mtv) do not output simple audio streams and demand direct access to the audio hardware through calls to mmap(). To run these programs with sound, you may have to use esdctl off to tell ESD to release /dev/dsp . This will allow those other programs to have exclusive access to the sound device without interrupting any of the Esound apps that might be streaming data to ESD. When /dev/dsp is free again, you can run esdctl on to hear output from your ESD applications.
Many people complain about low quality audio or high CPU usage when using ESD. This is usually because they are trying to play sounds at different sampling, or bit rates. ESD can only open the audio device in one mode when it starts up. When client applications give ESD streams in lower or higher sampling rates, it must convert and resample the waveform in realtime before piping it over to /dev/dsp . Needless to say, this process is more focused on speed than quality, and sometimes stereo signals are combined into mono.
Another nifty feature of Esound is its interface for audio monitoring. This makes it easy for external programs such as volume meters and oscilloscopes to intercept audio information. Previously, this kind of eye candy needed tight integration with each audio application so they could grab audio data before it disappeared into /dev/dsp . ESD allows this data to be shared with other applications, which has led to a proliferation of eye candy such as vsa and eXtace (which you can find at freshmeat).
Tip: If you hear excessive noise while playing low quality audio files, you might want to try using sox to perform a higher quality resampling: sox file.wav -V -s -w -v 0.9 -r 44100 newfile.wav resample
Tip: Cthugha, one of the older audio visualization apps, doesn't have a native interface to esd, but can work by starting it with the following commands: mkfifo /tmp/cthugha.esd xcthugha --play /tmp/cthugha.esd --silent & esdmon > /tmp/cthugha.esd