Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

migrated from serverfault.com Mar 22 '12 at 20:30

This question came from our site for professional system and network administrators.

add comment

1 Answer 1

up vote 5 down vote accepted

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 -L 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).


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 -L 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.

share|improve this answer
    
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 '12 at 21:42
    
Try pulseaudio --check ; echo $? to check if pulseaudio server is running. It should print 0 if running. –  andcoz Mar 23 '12 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 '12 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 '12 at 20:17
    
auth-ip-acl is supported since version 0.9.3. See freedesktop.org/wiki/Software/PulseAudio/Documentation/User/… –  andcoz Mar 23 '12 at 23:35
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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