Hack17.Configure Network Sound

Hack 17. Configure Network Sound

Set up local sound to play across the network.

In "Mix Your Audio for Perfect Sound" [Hack #13] I discuss how to use EsounD as a sound server to mix sounds from multiple programs for a sound card that supports only one input. One extra feature of EsounD is the ability to send and receive sound over the network. This can be particularly useful if you use programs like VNC over a local network, because you can use audio applications remotely and hear them on your local machine. Plus, in general, it's just pretty cool to be able to send sound around over the network.

To do this esd must be installed on the server (the machine on which you hear the sound). You don't have to have esd installed on the clientyour client doesn't even need a sound cardbut make sure your programs are EsounD-compatible. Most distributions should have EsounD packaged, so install it from your package management tool. If you use GNOME, EsounD is probably already installed. Once esd is installed on the server, you need to start it with special options so that it knows to listen to the network. Kill any open esd processes, and then start esd from the command line:

 greenfly@napoleon:~$ esd -promiscuous -tcp -public -port 16001 

You should hear a series of beeps on your computer to tell you that esd has started. Now on your client machine open a terminal and type:

 greenfly@moses:~$ esdplay --server ="ip_of_server:16001" sample.wav  

Replace ip_of_server with the IP address of the esd server. The audio file will play back on the remote server, so be sure to adjust the mixer on that machine so that you can hear it. This works fine on an application-by-application basis, but you can also set an environment variable so that any EsounD-compatible applications you start will output to the remote server. Type the following in a terminal:

 greenfly@moses:~$ export ESPEAKER="ip_of_server:16001" 

Now you can start XMMS, mplayer, xine, or any of the EsounD-capable audio players from this terminal and the sound will be sent over the network. Be sure to add this setting to your .bashrc so it's available each time you start a program.

You can also configure esd globally so that it automatically starts with these network options by default. This is particularly useful if you use GNOME on your esd server since GNOME is configured to start esd automatically. Edit your /etc/esound/esd.conf file and edit the default_options line to say:

 default_options=-promiscuous -tcp -public -port 16001 

Save your changes, and the next time esd starts, it will automatically start with those options enabled.

Linux Multimedia Hacks
Linux Multimedia Hacks
ISBN: 596100760
Year: 2005
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net