2

I am trying to forward a .wav sound over a ssh connection from a linux server to a local windows laptop. I ssh through MobaXTerm and X11 forwarding is on.

The goal is to output the sound from a program running on the linux box on my local speaker. For now, playing the sound directly would be sufficient.

$ paplay sound.wav does not produce any errors.

Pulse is configured, with paprefs, to find local speakers... but it doesn't.

The wav file plays fine on a local machine by mounting the directory, then playing with a windows-native player.

Is there an add on to MobaXTerm to support audio forwarding? How do I capture the forwarded sound on my Windows machine to fix what I perceive is currently a working, but not fully executed, solution?

2

SSH itself doesn't have a facility for graphics or sound forwarding. The X11 protocol is network-ready¹, which allows GUI applications to be very easily forwarded over the network: all SSH has to do is to forward the network connection. The side where applications display has to have an X11 server; in addition to being an SSH client, MobaXterm includes both a terminal emulator and an X11 server.

Sound doesn't work that way, but you can make it work that way by using a sound server](http://en.wikipedia.org/wiki/Sound_server). This means instructing the sound-producing application to use a network protocol, instructing SSH to forward the network connection, and having an application that plays sounds as received through a network connection on the client side. MobaXterm doesn't include the sound playing part, and Windows itself doesn't either (of course not) so you'll need to install one.

paplay talks to the PulseAudio sound server, and you can forward that connection through SSH. On the remote machine, run

pacmd load-module module-native-protocol-tcp

(it may already have been enabled system-wide). You can also do this through paprefs. You should now have a file called ~/.pulse-cookie or ~/.config/pulse/cookie depending on your distribution. Copy that file to the Windows machine.

With the SSH connection, forward a port to port 4713 on the server, say 4714. (You can pick 4713 on both sides; on the server side it has to be the port where PulseAudio is listening and that's 4713 by default.) (With the OpenSSH command line, you'd do ssh -L 4714:localhost:4713).

On Windows, install the PulseAudio port. I don't know how they work as I've never used them; you'll need to point them to the cookie file and to the forwarded connection (port 4714).

See also the official instructions (not all that helpful) and grawity's post on Super User which also explains how to transmit the PulseAudio connection without using SSH (this means less latency but is insecure and may be blocked by a firewall).

¹ By which I mean, it uses a protocol that is a network communication protocol in the first place.

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.