Sunday, September 11, 2011

PulseAudio + XMMS2

So you've been using XMMS2 for a little while and seen how frigging awesome it is, but now you want more. You want to access your XMMS2 library anywhere you take your laptop. So where do you start?


First off, disable the firewall on your host machine if you have one. Unless you are working a very hostile network environment, this will make things a lot easier until everything is working. After you've done that you have just one setting to change in xmms2. On the terminal, type

xmms2 server config core.ipcsocket "unix:///tmp/xmms-ipc-$USER;tcp://:9667"

assuming you still want to run clients on your host machine. On your client machine, run

XMMS_PATH=tcp://<server-hostname>:9667 xmms2 list

you should get the playlist of songs on your server. If everything checks out you can set your XMMS_PATH for your login shell. Add

export XMMS_PATH=tcp://<server-hostname>:9667

to whichever startup script your shell uses. At this point you should be able to control xmms2 remotely from your laptop. Next we'll set pulseaudio to push the music to your laptop.


To listen to your music on your laptop, you have to make the sound card on your laptop visible to the network. If you haven't yet, install paprefs on both your host machine and all clients. When you run paprefs, there should be four tabs; we'll only concern ourselves with the first two.

On your host, switch to the "Network Access" tab and toggle the first item. Now on each client, open the "Network Server" tab and check the first three boxes. These settings will load zeroconf modules and tell pulse to tunnel audio from your host to remote sound devices. Run pavucontrol on your host. Here's where you enable your networked audio devices to receive from your host. Find the xmms2 stream and select your remote machine from the drop-down.

That's it. You should be able to hear your music and control xmms2 remotely. Enjoy.

This guide shows how I got my setup the way I wanted, but it definitely isn't the only way. For instance, instead of using the native xmms2 protocol, you could just use ssh, and there are at least ten viable audio streaming options. If you have problems with this guide or want to share your setup, leave a comment or shoot me an email. Thanks for reading!