Ambrose Li

Most Linux systems already include a multi-room sound system, it’s called PulseAudio

I have been figuring out how to make a multi-room sound system for my home (mainly for clock chimes). I considered Snapcast, I looked at Volumio, but all along I never realized a basic solution has been right in front of me staring at my face.

My requirements

What I needed was something that would allow me to broadcast sounds (mainly clock chimes, recently also TV program announcements), and the sound should play in both my room (ordinary PC running Ubuntu) and the living room (Raspberry Pi running some flavour of OSMC). I tried Snapcast; I could not make it work.

The solution

The solution turned out to be PulseAudio, the default sound system on most Linux systems.

But the key to make it work is to configure RTP correctly. We start with the basic RTP setup described on PulseAudio’s “Network Setup” page,‍[Note 1] then make the following adjustments:‍[Note 2]

  • module_rtp_send needs the loop=1 parameter. This makes sure all PulseAudio servers will play every broadcast (otherwise PulseAudio will not play any sound that’s being broadcast from the same computer).
  • module_rtp_recv needs the sink parameter set to the Name of the correct speaker if PulseAudio is controlling multiple speakers (which is usually the case these days because the HDMI port counts as a speaker). This avoids playing broadcasts on random speakers.

On laptops you might need to write a script to monitor your location and load/unload these modules as appropriate.

PulseAudio solves my problem (clock chimes) perfectly. I’ve yet to see if it’s good enough for more demanding tasks like radio broadcasts; but with RTP working it’s probably not too hard to layer something better on top of PulseAudio. Now I have to solve my other multi-room problem: mesh wifi.

Notes

  1. “Network Setup,” last modified May 7, 2021, https://​www​.freedesktop​.org/​wiki/​Software/​Pulse​Audio/​Documentation/​User/​Network/​#rtp. Ubuntu ships with a more elaborate default setup for the rtp sink; all it does is to make the default settings explicit.
  2. See “PulseAudio Modules,” last modified July 9, 2021, https://​www​.freedesktop​.org/​wiki/​Software/​Pulse​Audio/​Documentation/​User/​Modules/​#rtpsdpsaptransportmodules.