PulseAudio is a great network audio server for Linux. It allows me to stream audio between machines. However, the biggest problem with PulseAudio is that it doesn’t have a descent client implementation for Windows. There are a couple known workarounds such as using WinESD, but they are all pretty experimental. Also, the Win32 binary build didn’t work for me, perhaps because it’s somewhat outdated and buggy.
My first try was to use LineInCode and Netcat for Windows on the client side and to use module-simple-protocol-tcp
on the server side. After adding -L "module-simple-protocol-tcp port=4712 rate=44100 format=s16le channels=2"
option to the PulseAudio startup option, I was able to stream audio from Windows to PulseAudio server using the following command:
linco.exe -B 16 -C 2 -R 44100 | nc.exe <host> 4712
However, PulseAudio dies whenever the connection is closed because of a known issue of module-simple-protocol-tcp
. I wrote some script that restarts PulseAudio whenever it dies, but I realized there’s a better solution – OpenSSH.
I have installed a Cygwin build of OpenSSH, and replaced Netcat with it:
linco.exe -B 16 -C 2 -R 44100 | ssh.exe <user@host> "cat - | pacat --playback"
This solution works without module-simple-protocol-tcp
, and therefore there’s no need to restart the PulseAudio server on disconnection. Better security is another bonus. Instead, it requires a running SSH server. If SSHD is not running in the PulseAudio server, you can give it a little twist:
linco.exe -B 16 -C 2 -R 44100 | ssh.exe <user@otherhost> "cat - | pacat --server <host> --playback"
In case your Windows machine doesn’t have a sound card or it doesn’t allow you to capture the audio stream, you might want to use Virtual Audio Cable. It’s a commercial software, but it is worth a purchase.
You might also want to set up a passwordless login so you don’t have to enter the password every time you stream the audio.