My colleague kept going on about his SONOS wireless Hi-Fi setup, which basically made him able to control the music in each room around his house, from a single device.
While that sounded incredibly neat, the entire setup was way to expensive for me, and offered little to no customizability. However, at that point I had just acquired my first Raspberry Pi and recently started using PulseAudio due to the Steam for Linux being released.

Now, the configuration I will go through is my setup, and you might need to adjust some things to your liking.

My setup:

  • Workstation (Gentoo) running MPD
  • Raspberry Pi (Raspbian) in the Kitchen with Analog Speakers
  • Raspberry Pi (Raspbian) in the Livingroom with Analog Speakers
  • Raspberry Pi (Raspbian) in the Bathroom with Analog Speakers

Setting up a Raspberry Pi

To begin with, the Pi has to be setup. I’ll assume you have installed a completely fresh Raspbian image.

Setting up the networking interface

I prefer having static IP addresses on my always-on devices. So open up /etc/network/interfaces/ in an editor.

# Obviously, you should match these with your networking setup.
iface eth0 inet static
      address    192.168.1.7
      gateway    192.168.1.1
      netmask    255.255.255.0
Getting Pulseaudio and modules

So, now you have setup the networking interface. There is no need to reboot just yet.

Let’s start out with installing the things we need.

apt-get install pulseaudio avahi-daemon pulseaudio-module-zeroconf
Autostarting Avahi for publishing the sink

Now, we need avahi-daemon to start on boot

update-rc.d avahi-daemon defaults
Editing the configuration

Then open up /etc/default/pulseaudio

PULSEAUDIO_SYSTEM_START=1
DISALLOW_MODULE_LOADING=0

Now open up /etc/pulse/system.pa

load-module module-dbus-protocol access=local,remote
load-module module-native-protocol-tcp auth-ip-acl=192.168.1.101 # MPD Source
load-module module-zeroconf-publish

Then open up /etc/pulse/default.pa

load-module module-native-protocol-tcp auth-ip-acl=192.168.1.101 # MPD Source
load-module module-zeroconf-publish

The auth-ip-acl parameter in default.pa and system.pa is for security. You can use either auth-anonymous=1 or auth-ip-acl=192.168.1.0/24 if you want more devices to be able to access the remote sink. Logically auth-anonmyous allows non-authenticated devices to connect, and auth-ip-acl allows specific ip’s and/or ranges to connect.

One last thing, we need to check that the output is not muted nor too low.

sudo -u pulse alsamixer

If it says MM in the bottom of the slider, press M once. If the slider is at 00, press Page Up or Up a couple of times.

Now, you can go ahead and plug in your Pi into your sound setup. Remember to remove the HDMI cable if you want to use the Analog output.

Setting up your workstation

Configure Pulseaudio

I won’t go through setting up Pulseaudio on your workstation, as I expect your distribution provides better documentation for that or even ships with a working configuration of Pulseaudio.

However, you’d want to install avahi-daemon here as well, and set it to autostart the service on boot, and start it now.
Secondly you should get pavucontrol and paprefs, these will make your Pulseaudio experience a whole lot better.

Fire up paprefs go to Network Access, check Make discoverable PulseAudio network sound devices available locally.
If you then open up pavucontrol you should be able to see your remote sink(s) under Output Devices, labelled bcm2845 ALSA Analog Stereo on pulse@HOSTNAME.

If you want, you can open some audio in your preferred application, then go to Playback in pavucontrol and in the applications dropdown menu, select the remote sink. There should be a second or two of delay before your remote sink will play the sound.
If not, it might be that your volume is set too low, got to Output Devices and turn up the crank. I prefer having the volume at maximum 80% to avoid crackling and distortion.

Configure MPD

First, execute # pacmd list-sinks | grep "name: <t" and save the output. You are going to need these names in just a moment.

There are several ways to achieve this, but I’ll show the easiest way, however most insecure. Open up your ~/.mpd.conf (sigh, no xdg).

# INSECURE: First set to listen on all interfaces, or the same network as your RPi's
# INSECURE: Only needed if you want to control your sound with and external device
bind_to_address "*"

# Add one of these for each remote sink.
audio_output {
	type	"pulse"
	name	"Kitchen"
	sink	"tunnel.HOSTNAME.local.alsa_output.platform-bcm2835_AUD0.0.analog-stereo"
}
Optional: Configure MPDroid
  • Download MPDroid from the Google Play Market Store Application Get or whatever the hell it is called.
  • Open up the application
  • Go to Settings
  • Go to Connection Settings
  • Go to WLAN based connection
  • Go to <YOURNETWORKNAME>
  • Go to Host
  • Input the IP of the MPD server
  • Click OK

You’re now done setting up MPDroid. However I suggest using the feature “Pause Playback” and “Resume Playback” in the Settings.
While you are in the Now Playing screen, touch the speaker icon and you are now able to choose the MPD audio_outputs.

Optional: Configure ncmpcpp

If you like me, use ncmpcpp to control mpd with, you might want to compile it with --enable-outputs, then with ncmpcpp running you can press F8 or 8 to open the outputs control.

Title Date
Steam What a mess you have made!
Half-Life 2 Deathmatch on Linux
Steam in a Clean Environment
SteamLUG Game Night 2
Steam Tools for Linux
SteamLUG Game Night
Half-Life mods on Steam for Linux
Double Fine Adventures
Steam for Linux and something else
Dir Colors Script