If you use pulse-audio as sound server, you can use module-native-protocol-tcp
to accept tcp connection from your remote machine.
In the following example, I use an ssh tunnel to forward the audio request from remote machine to the local one.
On the local machine, do something like:
pactl load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
ssh -R 9999:127.0.0.1:4713 you@remotehost
then on remote machine you can use paplay
paplay -s 127.0.0.1:9999 soundfile.wav
ADDED I discovered that auth-ip-acl
does not accept localhost
as a valid parameter, you have to use 127.0.0.1
(or whatever your machine uses localhost address).
EDIT It should be ssh -R
, not ssh -L
(we are forwarding a remote port to a local port).
If you have an old version of pulse-audio (pre 0.9.3), you can use cookie based authorization.
pactl load-module module-native-protocol-tcp auth-anonymous=1 auth-cookie-enabled=0
scp ~/.pulse-cookie you@remotehost:
ssh -R 9999:localhost:4713 you@remotehost
Obviously, you can simply do not use any authentication in pulse-audio but I can not recommend you this solution. Use, at least, a firewall to avoid remote connections.