11

So I have finch, a command line chat client (think pidgin) running on a remote machine that I ssh into. finch has notification sounds and can run a command when certain events occur, letting you pass the sound file in as %s. e.g. mplayer %s

from the remote machine, when the notification occurs, what kind of command could I run to play whatever %s is on my local machine?

1 Answer 1

11

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.

7
  • getting "Failure: Module initialization failed" on pactl load-module module-native-protocol-tcp auth-ip-acl=localhost. Am I missing a dependency or something?
    – tester
    Mar 22, 2012 at 21:42
  • Try pulseaudio --check ; echo $? to check if pulseaudio server is running. It should print 0 if running.
    – andcoz
    Mar 23, 2012 at 15:55
  • On my machine (opensuse 12.1), the module is in /usr/lib64/pulse-1.1/modules/module-native-protocol-tcp.so. Which distribution are you running on?
    – andcoz
    Mar 23, 2012 at 15:57
  • my local machine echos 0 properly.. remote is on ubuntu 11.10 and my local is on 11.04. i tried referencing the module directly on my local pactl load-module /usr/lib/pulse-0.9.22/modules/module-native-protocol-tcp.so auth-ip-acl=localhost and I get Failure: Invalid argument. Any idea? (btw thanks for helping)
    – tester
    Mar 23, 2012 at 20:17
  • auth-ip-acl is supported since version 0.9.3. See freedesktop.org/wiki/Software/PulseAudio/Documentation/User/…
    – andcoz
    Mar 23, 2012 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.