Snapcast: Synchronized Multi-Room Audio for Your Homelab
Multi-room audio — the same music playing in every room in sync — typically requires Sonos (expensive), Apple HomePod (locked into Apple), or a commercial whole-home audio system (very expensive). Snapcast is an open-source alternative that achieves synchronized audio across any mix of Linux devices, Raspberry Pis, and phones.
Photo by GuerrillaBuzz on Unsplash
The synchronization is the hard part, and Snapcast does it well: clients buffer and align audio to a shared clock, keeping speakers in sync to within a few milliseconds.
How Snapcast Works
Snapcast uses a client-server model:
- Snapserver: The central audio hub. It takes audio input from any source (MPD, Mopidy, Spotify via librespot, Shairport-Sync for AirPlay) and streams it to connected clients.
- Snapclient: The player. Runs on each endpoint — Raspberry Pi, speaker box, phone — and plays audio in sync with all other clients.
The server manages synchronization. Each client adjusts its playback timing based on a shared clock reference, eliminating the echo or delay you'd get from a simpler setup.
Server Installation
Docker Compose (recommended for homelab):
services:
snapserver:
image: ghcr.io/saiyato/snapserver:latest
container_name: snapserver
restart: unless-stopped
network_mode: host
volumes:
- ./snapserver.conf:/etc/snapserver.conf
- snapserver-data:/var/lib/snapserver
devices:
- /dev/snd:/dev/snd
volumes:
snapserver-data:
network_mode: host is needed for mDNS discovery to work. The audio device passthrough (/dev/snd) allows Snapserver to access ALSA on the host.
Native install on Debian/Ubuntu:
apt install snapserver
On Raspberry Pi:
apt install snapserver snapclient
Server Configuration
Edit /etc/snapserver.conf:
[server]
threads = -1
[stream]
# Pipe input — other programs write audio here
source = pipe:///tmp/snapfifo?name=default&sampleformat=48000:16:2&codec=pcm
# Or: a named pipe per source
# source = pipe:///tmp/mpd&name=MPD
# source = pipe:///tmp/spotify&name=Spotify
[http]
enabled = true
port = 1780
[tcp]
enabled = true
port = 1704
The pipe:///tmp/snapfifo creates a FIFO (named pipe) that audio sources write to. Any program that can output raw PCM audio can feed Snapcast.
Like what you're reading? Subscribe to HomeLab Starter — free weekly guides in your inbox.
Connecting Audio Sources
MPD (Music Player Daemon)
MPD's audio output can be configured to write to Snapcast's pipe:
# /etc/mpd.conf
audio_output {
type "pipe"
name "Snapcast"
command "cat >> /tmp/snapfifo"
format "48000:16:2"
}
Mopidy
For Spotify/YouTube via Mopidy:
# /etc/mopidy/mopidy.conf
[audio]
output = audioresample ! audio/x-raw,rate=48000,channels=2,format=S16LE ! audioconvert ! wavenc ! filesink location=/tmp/snapfifo
Librespot (Spotify Connect)
Librespot provides a Spotify Connect endpoint that streams to Snapcast:
librespot --name "Home Audio" \
--backend pipe \
--device /tmp/snapfifo \
--format S16 \
--bitrate 320
This makes Snapcast appear as a Spotify Connect device. Play to it from any Spotify client.
Shairport-Sync (AirPlay)
For AirPlay support from iOS/macOS:
# /etc/shairport-sync.conf
general = {
name = "Home";
};
alsa = {
output_device = "your_device";
};
pipe = {
name = "/tmp/snapfifo";
};
With this, iPhone/iPad users can AirPlay to Snapcast.
Snapclient Setup
Each audio endpoint runs snapclient:
Raspberry Pi with USB audio adapter or analog output:
apt install snapclient
# Edit /etc/default/snapclient
SNAPCLIENT_OPTS="-h your-snapserver-ip --player alsa"
systemctl enable --now snapclient
Docker on any Linux machine:
services:
snapclient:
image: ghcr.io/saiyato/snapclient:latest
network_mode: host
environment:
SNAPSERVER: your-snapserver-ip
DEVICE: default # ALSA device name
devices:
- /dev/snd:/dev/snd
restart: unless-stopped
Android: The "Snapdroid" app on F-Droid or GitHub connects to a Snapserver.
iOS: Several third-party apps support Snapcast, though AirPlay to Snapcast (via Shairport-Sync) is often simpler.
Grouping and Volume Control
Snapcast supports grouping clients into zones. All clients in a group play in sync. Volume is controlled per-client.
Snapweb (built-in UI): Access http://snapserver:1780 for a simple web interface to control groups and volume.
Home Assistant integration: The official Snapcast integration in HA lets you control volumes and groups from the HA dashboard and automations.
# configuration.yaml
media_player:
- platform: snapcast
host: your-snapserver-ip
Each Snapcast client appears as a separate media player entity in Home Assistant, controllable via the Lovelace UI or automations.
Home Assistant Automation Examples
Turn on all clients when music starts:
automation:
trigger:
- platform: state
entity_id: media_player.snapcast_kitchen
to: playing
action:
- service: media_player.volume_set
target:
entity_id: media_player.snapcast_living_room
data:
volume_level: 0.4
Announce time/weather without stopping music: Use TTS with Snapcast by adjusting volume, playing the announcement, then restoring.
Audio Hardware for Each Room
Common Snapclient hardware options:
Raspberry Pi Zero 2 W + USB audio: ~$20 total. USB audio adapters cost $5-15 and give clean output. Mount inside a small enclosure and connect to powered speakers or an amp.
Raspberry Pi 3/4 + HiFiBerry HAT: For audiophile quality. HiFiBerry makes DAC HATs with optical output, phono output, and amplified output for passive speakers.
Old laptop or mini PC: Install Linux and snapclient. Instant audio endpoint without additional hardware.
Existing media player (Raspberry Pi running Kodi/Plex): Run snapclient alongside your existing media software — it runs as a background service and doesn't interfere.
Latency and Synchronization
Snapcast's default latency is around 1 second (1000ms). This means there's a 1-second delay from source to speakers, which is imperceptible for music but matters for video sync.
Reducing latency: Lower buffer settings reduce delay but require all clients to have stable network connections.
# snapserver.conf
[stream]
source = pipe:///tmp/snapfifo?name=default&buffer=500
For video sync with Kodi or Jellyfin, additional configuration matches Snapcast's buffer to the video player's audio delay setting.
Snapcast vs. Alternatives
| System | Cost | Ecosystem lock | Audio quality | Latency |
|---|---|---|---|---|
| Snapcast | Free | None | Good | ~1s |
| Sonos | $200+/room | Sonos | Excellent | Low |
| AirPlay 2 | Hardware varies | Apple | Good | Low |
| Chromecast Audio | Discontinued | Good | Low | |
| Roon | $120/yr + hardware | Roon | Audiophile | Low |
Snapcast wins on cost and flexibility. It loses on out-of-box convenience and mobile app polish. For a homelab where you enjoy configuring things, it's an excellent choice.
Getting Started
- Deploy Snapserver on your main homelab server or NAS
- Connect an audio source (MPD, Mopidy, or Librespot for Spotify)
- Set up one Snapclient on a Raspberry Pi in a test room
- Play music via your source and verify it reaches the client
- Add more clients room by room
- Integrate with Home Assistant for consolidated control
The Snapcast repository is badaix/snapcast with active development and a helpful community forum for hardware-specific setup questions.
