esdsample Command in Linux



The esdsample command in Linux is a tool linked to the Enlightened Sound Daemon (ESD). It loads audio samples into the ESD server, allowing you to play or manage these sounds through the ESD sound system. The audio sample files remain in the server's memory until we remove them manually or restart the server.

In this tutorial, you will learn how to install and use the esdsample command in Linux.

Table of Contents

Here is a comprehensive guide to the options available with the esdsample command in linux −

How to Install esdsample in Linux?

esdsample is an outdated/deprecated tool that is not pre-installed in modern Linux distributions. However, you can still install it using a distribution-specific package manager like apt, dnf, etc. Here is a step-by-step guide to installing this tool on Linux −

Step 1: Install esound

To use esdsample on your system, you must install the esd package. For this purpose, use one of the following commands depending on your Linux distribution −

#for Debian-based Systems
sudo apt install esound

#for CentOS or Fedora
sudo dnf install esound

#for Arch Linux
sudo pacman -S esound

However, you may encounter an error while running this command because esd is no longer maintained by default in most Linux distributions −

Install esound

Step 2: Download esound From Source

In case you face an error, you must download it from the source using the following command −

wget http://ftp.gnome.org/pub/gnome/sources/esound/0.2/esound-0.2.41.tar.gz

The output shows that the esound has been successfully downloaded −

Download esound From Source

Step 3: Extract the Source Code

After downloading the source file for esd, use the following command to extract the downloaded file −

tar -xvzf esound-0.2.41.tar.gz
Extract the Source Code

Step 4: Navigate to the Extracted Directory

Now use the cd command to access the directory created by the extraction process −

cd esound-0.2.41
Navigate to the Extracted Directory

Step 5: Configure and Install esdsample

After this, configure the extracted source file by running the following command −

./configure
Configure and Install esdsample

Now compile the source file using the following command −

make
Compile The Source File Using Make

Finally, use the below-mentioned command to install the compiled source code on your system −

sudo make install

As a result, this command will install esd package (including the esdsample) on your machine −

Sudo Command Will Install esd Package

Step 6: Confirm the esdsample Installation

Now you can verify the successful installation of the esdsample command by accessing its manual page −

man esdsample

The manual page has been accessed, which confirms the successful installation of the esdsample on our system −

Confirm the esdsample Installation

Once esdsample is successfully installed, you can use it to play sample audio files.

How to use esdsample in Linux?

You can follow the below syntax to use the esdsample command in Linux −

esdsample [options] filename

esdsample Command Options

The valid options for this command are listed in the following table along with the description −

Option Description
-s hostname:port It connects the ESD server to the specified hostname and port.
-b It specifies the output in 8-bit format. The default output format is 16-bit.
-d This option plays the sample as raw data from a file. By default, the esdsample command reads from a sound file like .wav, .au, etc. When using this option, filename refers to a file.
-e Use this option to play the sample from the ESD cache. Here, filename refers to the sample in the cache.
-h It shows the help page of the esdsample command.
-m The default output is in stereo format. However, this option sets the output to mono format.
-r freq The default output rate is 44.1 kHz. You can use this option to set the output rate to the specified freq.

Examples of esdsample Command in Linux

Lets discuss a few examples of esdsample commands in Linux systems. This will help you in learning how to get started with the command.

  • Play Sample Audio from a File Using esdsample
  • Play Sample Audio from the esd cache

Play Sample Audio from a File Using esdsample

You can use the esdsample command followed by the file name to play a sample audio from a file using the esdsample command −

esdsample audioFile.wav

This command loads the audioFile.wav into the cache and then plays it.

Play Sample Audio from the esd cache

You can use the -e option with the esdsample command to play sample audio directly from the cache −

esdsample -e esdctl:audioFile.wav 

Here, the -e option specifies that the sample should be fetched from the esound cache, represented by esdctl:audioFile.wav.

Conclusion

The esdsample command in Linux is used to load and play audio samples via the Enlightened Sound Daemon (ESD). Although esdsample is deprecated and better alternatives are available in modern Linux distributions, it can still be installed and used by following the appropriate steps, including manual installation from the source.

This tutorial provided a detailed step-by-step explanation on installing and using esdsample, along with examples for playing audio files.

Advertisements