esd Command in Linux



The esd command in Linux, often confused with the more commonly known sed (stream editor), is actually related to the Enlightened Sound Daemon (ESD). ESD was a sound server system that allowed for multiple applications to access the audio hardware simultaneously. It has since been largely replaced by more modern sound servers like PulseAudio and ALSA in most Linux distributions.

As a brief recap, esd stands for Enlightened Sound Daemon. It's a sound server for Linux systems that provides audio mixing and management capabilities. It's essentially a software layer that handles sound output, allowing multiple applications to use audio simultaneously.

Table of Contents

Here is a comprehensive guide to the options available with the esd command −

Understanding esd Command

There is indeed an esd command in Linux, which stands for Enlightened Sound Daemon. It's a sound server that provides audio mixing capabilities. For current audio management, you would typically use commands associated with PulseAudio or ALSA. For example, aplay and arecord are common ALSA commands for playing and recording audio, respectively. PulseAudio has its own set of tools like pactl and pacmd for managing audio streams and configurations.

  • Audio Mixing − esd acts as a central hub for audio data. Multiple applications can send audio streams to it, and esd mixes them together before sending the final output to the sound hardware.
  • Device Management − It handles interactions with the underlying sound card, providing a consistent interface for applications.
  • Client Applications − Various tools and applications can interact with esd to play, record, or manipulate audio.

If you're working with a modern Linux distribution, it's recommended to look into these newer audio systems for your audio handling needs.

Common Options with esd Command

Here are some common options for the esd command −

Options Descriptions
-unix Uses Unix domain sockets instead of TCP/IP.
-tcp: Uses TCP/IP sockets instead of Unix domain.
-public Makes TCP/IP access public (not just localhost).
-promiscuous: Starts unlocked and owned (disables authentication). Not recommended.
-terminate Terminates the esd daemon after the last client exits.
-noterminate Prevents the esd daemon from terminating after the last client exits.
-nobeeps Disables startup beeps.
-as SECS Frees the audio device after a specified period of inactivity.
-r RATE Sets the sample rate for the server.
-b Runs the server in 8-bit sound mode.
-d DEVICE Forces esd to use the specified sound device.
esdcat Reads audio data from standard input and sends it to the sound server.
esddsp: Applies digital signal processing effects to audio data.
esdloop Creates an audio loopback.
esdplay Plays audio files.
esdsample Generates test audio samples.
esd-config: Manages esd configuration.
esdctl Controls esd settings.
-v, --version: Prints version information.
-bind ADDRESS: Binds to the specified address (TCP/IP only).
-port PORT: Listens for connections at the specified port (TCP/IP only).
-trust: Starts esd even if using /tmp/.esd might be insecure.
-beeps: Enables startup beeps.
esdfilt Filters audio data.
esdmon Monitors esd activity.
esdrec Records audio from the sound server.
Possible devices /dev/dsp, /dev/dsp2, etc.
Configuration file /etc/esd.conf
Related commands esdcat, esddsp, esdloop, esdplay, esdsample, esd-config, esdctl, esdfilt, esdmon, esdrec

How to Use esd Command in Linux?

While esd itself is primarily used for starting and configuring the sound server, there are several related commands that interact with it −

esd -d /dev/dsp2 -r 44100 -as 300 -unix
Use esd Command in Linux

This command starts the esd daemon using the /dev/dsp2 sound device, sets the sample rate to 44100 Hz, frees the audio device after 300 seconds of inactivity, and uses Unix domain sockets for communication.

Here are some practical examples of how you might use the esd command −

Starting the esd Daemon

The most basic usage is to start the esd daemon −

esd
Starting the esd Daemon

This will start using default settings. You can customize its behavior with various options as discussed earlier.

Specifying a Sound Device

If you have multiple sound devices, you can specify which one esd should use −

esd -d /dev/dsp1
Specifying Sound Device esd Command

This will start esd using the /dev/dsp1 sound device.

Adjusting Sample Rate

You can set the sample rate for the audio −

esd -r 48000
Adjusting Sample Rate esd Command

This will set the sample rate to 48000 Hz.

Configuring Network Access

To allow network access to the sound server (not recommended for security reasons) −

esd -tcp -public
Configuring Network Access esd Command

This will enable TCP/IP access to the esd server, making it accessible from other machines on the network.

Disabling Beeps

If you find the startup beeps annoying −

esd -nobeeps
Disabling Beeps esd Command

This will disable the startup beeps.

Using a Configuration File

You can create a configuration file (usually /etc/esd.conf) to store your preferred settings −

DEVICE=/dev/dsp1
RATE=44100
AS=300
UNIX=true

Then, start esd without any options to use the configuration file. However, if you're working with a legacy system that still uses ESD, here are some examples of how the esd command might be used −

Playing an Audio File

To play a sound file using esd, you could use the following command −

esdplay audiofile.wav
Playing Audio File esd Command

This command would send the audio file directly to the sound daemon for playback.

Recording Audio

If you wanted to record audio, the esd command would look something like this −

esdrec > audiofile.wav
Recording Audio esd Command

This command would record audio until stopped and save it to a file.

Monitoring Audio

For monitoring the audio being played by other applications through ESD, you could use −

esdmon | esdplay
Monitoring Audio esd Command

This command would capture the audio being played and then play it back, essentially echoing all sound output.

Network Audio Streaming

ESD also allowed for network audio streaming. To send audio over the network to another machine running ESD, you could use −

esdcat -s hostname:portnumber < audiofile.wav
Network Audio Streaming esd Command

Replace hostname with the IP address or hostname of the target machine and portnumber with the appropriate port number.

Please note that these commands are based on the historical usage of ESD and may not be applicable to modern Linux systems that no longer support ESD.

Conclusion

Enlightened Sound Daemon (esd) is an older sound server for Linux systems. It was primarily used to manage audio output, allowing multiple applications to share audio hardware without conflicts. However, it has largely been superseded by more modern sound servers like PulseAudio and ALSA. Because of these limitations, PulseAudio and ALSA have become the preferred choices for audio management on Linux systems. They offer better performance, stability, and a wider range of features.

Advertisements