Sunday, August 21, 2011

How to stream audio from on Ubuntu laptop to remote linux box

The problem: I recently got a linux set-top box that I have connected to my stereo in my living room. I use the internet music service and I'd like to be able to play it on my stereo and control it from my linux laptop.

I've tried lots of approaches that didn't work, like using vnc/nx/etc and setting up pulseaudio with module-tunnel-sink.

The way that seems to work the best for me is to first, setup pulseaudio on the settop box to install the module-native-protocol-tcp by adding the following line to /etc/pulse/

load-module module-native-protocol-tcp auth-ip-acl=;

and restart pulseaudio with:

pulseaudio --kill ; pulseaudio --start

This tells pulseaudio to accept network connections from other machines on the local network.

Then, on my laptop, I run google-chrome as follows:

PULSE_SERVER=tcp:[settop box hostname] google-chrome --user-data-dir=/home/redstone/tmp/chrome-mog --app=

This starts a separate chrome session that will stream audio to the settop box. Note: you are free to simultaneously start google-chrome without the flags and start a google chrome sessions that will use your local laptops speakers as well. The reason for the user-data flags is that you can only specify the pulse server to use when chrome starts a new session, and if you don't start chrome with the user-data flags, it will just open a new window in your existing chrome session rather than start a new one.

You may want to run:
PULSE_SERVER=tcp:[settop box hostname] pavucontrol
to fiddle with the audio settings on the settop box.

I suspect that this approach should work with any other internet music streaming service like spotify/pandora/etc.

No comments:

Post a Comment