Remote Sound


Contents

Transfering sound

When you are logged in on the DTU servers from your home computer, it is posible to play sound from the servers on your computer. It can be done in two ways:

  1. By manully transfering a sound file through a SSH-channel to a player on your computer.
  2. By using the eSound daemon (ESD).

Note: Transfering sound requires some bandwith. If you are using the eSound daemon or if you manually plays a wave file, the transfer rate is around 200kb/s (~2Mbit/s). If you transfer mp3 files, the bandwith needed depends on the bit rate. The average may be around 30kb/s (~256kbit/s).

If you connects to DTU from a Linux box using ThinLinc, ThinLinc manages sound transfer transperantly. It uses the eSound daemon. For further information, see Access to the G-Bar servers using ThinLinc.

1. Manually by SSH

Note: This method is mostly intended for use from a Linux client. It can be done from a Windows client with the help from Cygwin. Use the openSSH package and the eSound package.

Requirements:

  1. A player which accepts the format you want to play (.mp3, .wav and others) and accepts data from stdin.
  2. A SSH-client, and (for method 1) a SSH-server.

There is a number of players who support data from stdin. Four of them are

Command line for stdin: esdcat
Command line for stdin: aplay
Command line for stdin: mpg123 -
Command line for stdin: madplay -

You can use one of the two firsts to play wav-files and one of the two lasts to play mp3-files.


Method 1: Connecting from server to home computer

This method requires a SSH-server running on your computer.

Examples:

 bohr $>cat wavefile.wav | ssh me@mycomputer 'cat - | esdcat'
 bohr $>cat wavefile.wav | ssh me@mycomputer 'cat - | aplay'
 bohr $>cat file.mp3 | ssh me@mycomputer 'cat - | mpg123 -'
 bohr $>cat file.mp3 | ssh me@mycomputer 'cat - | madplay -'

Method 2: Connecting from home computer to server

Here you need to manually type in the name and location of your file relative to your home dir.

Examples:

 mycomputer $>ssh s801234@bohr.gbar.dtu.dk 'cat path/to/wavefile.wav' | esdcat
 mycomputer $>ssh s801234@bohr.gbar.dtu.dk 'cat path/to/wavefile.wav' | aplay
 mycomputer $>ssh s801234@bohr.gbar.dtu.dk 'cat path/to/file.mp3' | mpg123 -
 mycomputer $>ssh s801234@bohr.gbar.dtu.dk 'cat path/to/file.mp3' | madplay -

2. Using the eSound daemon (ESD)

This way of doing it is similar the way ThinLinc handles sound. See Access to the G-Bar servers using ThinLinc.

Linux:

On your home computer:

1. Make sure the eSound daemon (esd) is installed.
2. Start esd by typing:
esd -tcp -bind 127.0.0.1.
-tcp ensures the use of the tcp protocol.
-bind 127.0.0.1 makes sure to use IPv4. (Instead of IPv6).
3. Make an SSH-tunnel from a port on one of the servers (e.g. port 33001) to your computer, port 16001:
ssh -X -C -R 33001:localhost:16001 s801234@hald.gbar.dtu.dk
If the port number 33001 is used by another user, try another (preferably close to 33000). The port 16001 is the port number given by esd (default is 16001).

On the server:
In the SSH-terminal you just opened, type:

export ESPEAKER=127.0.0.1:33001

You can now play music by using the esd-output. E.g.:

mplayer:

mplayer -ao esd file.wav

xmms:

  1. Start xmms by typing: xmms soundfile.wav
  2. Press CTRL-p
  3. Under Output plugin choose eSound
  4. Click Ok and the play button.

Windows

On Windows, using Cygwin and openSSH and esd compiled for Cygwin, it cam be don in the excactly same way - except for a slight detail about esd. See below.

It can also be done with PuTTY replacing openSSH. It is the same, although you have to click a few different places with your mouse. Therefore this walkthrough:

1. Install Cygwin and the eSound package for Cygwin
2. Start a Cygwin terminal window and write:
while true; do
  esd -tcp
done
This is because on Windows, esd quits when the player stops playing. The above lines ensures a respawn of esd when it quits. To end it, press and hold CTRL-c for a short while.
3. Start PuTTY.exe
4. Type in the desired server name (e.g. hald.gbar.dtu.dk).
5. Select (to the left) Category => Connection => SSH => Tunnels
6. Select X11-forwarding.
Note that this is only nescesary if you want the graphic display forwarded. See below.
7. Choose a port number (e.g. 33001) and write it in the source port field.
8. Write localhost:16001 in the destination field.
9. Choose Remote
10. Click Add
11. Click Open and log in.
12. Write:
export ESPEAKER=127.0.0.1:33001 

It should now be possible to play music by using the esd-output. E.g.:

mplayer:

 mplayer -ao esd file.wav

xmms:
In order to start xmms, it need a graphic display. It cannot directly use the graphic server for Windows, but Cygwin includes an Xserver for Windows. In a Cygwin terminal window, type:

 X -multiwindow

and be shure to have selected X11-forwarding in PuTTY (above).

It should now be possible to start xmms:

  1. Start xmms by typing: xmms soundfile.wav
  2. Press CTRL-p
  3. Under Output plugin choose eSound
  4. Click Ok and the play button.