Prerequisites

Computers Running PulseAudio

You need two computers running PulseAudio on the same network. You probably already have this, or you probably wouldn’t be here.

I have a Raspberry Pi downstairs hooked up to my stereo. I like to send audio from my upstairs Ubuntu Desktop so I can have the same music synced throughed the house. By default, PulseAudio on Raspbian runs in user mode, so a user needs to be logged in for it to run, and for network audio to work.

If you don’t want to deal with having to login to remote machines everytime you want to combine audio with them, you can configure PulseAudio in system mode.

PulseAudio does not recommend this, but I do it on my pi for convenience. Setting that up is beyond the scope of this guide, but I will try to post a guide for it and link it here.

Anyways, before setting up system mode, all I did was ssh to the pi with -X to forward X. Then I’d run pavucontrol and PulseAudio would fire up. You’re going to want that program installed on your source machine anyways.

Install pavucontrol

We’re going to use pavucontrol to change which output a given application is using. It will let you control other things like volume.

Modify accordingly for your distribution:

$ sudo apt-get install pavucontrol

Install paprefs

We’re going to use a utility called paprefs to configure PulseAudio without having to manually edit the config files.

Modify accordingly for your distribution:

$ sudo apt-get install paprefs

Source Configuration

On the machine where your sound source originates, run paprefs.

On the first tab, Network Access, check the first box: Make discoverable PulseAudio network sound devices available locally

This will tell PulseAudio to look for network sound devices published with zeroconf and allow them to be used locally.

Target Configuration

On the machines where you want to play your sound, run paprefs. You can do this over forwarded X if you need.

On the second tab, Network Server, check the first three boxes: Enable Network access to local sound devices Allow other machines on the LAN to discover local sound devices Don’t require authentication

These should all be pretty self-explanatory. Essentially, we tell PulseAudio to advertise local sound cards with zeroconf. We allow our source machine to use them without authentication.

Combining sinks

Restart pulseaudio on all machines with pulseaudio -k. On the source machine, you should be able to open pavucontrol and see your remote sound cards listed in the Output Devices tab.

Now, you can easily switch between availabe sinks on the Playback tab, but you most likely want to send to multiple sinks at the same time. Here’s where we leverage module-combine-sink to stitch all of these together:

Get the sink names:

First we need the names of our sinks:

$ pacmd list-sinks | grep name:
	name: <alsa_output.pci-0000_0a_00.3.iec958-stereo>
	name: <tunnel.pi.local.alsa_output.platform-soc_sound.iec958-stereo>

Your output will look a bit different, but the above shows the two sinks I want to combine. Now I just call pacmd again to combine them:

$ pacmd load-module module-combine-sink \
  sink_name=Combo_Sink \
  slaves=alsa_output.pci-0000_0a_00.3.iec958-stereo,tunnel.pi.local.alsa_output.platform-soc_sound.iec958-stereo

Note that we did not include < or > in the pacmd command.

Confirm that it worked

Now pop open pavucontrol again and go to the Playback tab. You should be able to select your combo sink from the dropdown. You should hear music coming through both machines!

Happy listening!