🎧 Guía Completa: Configura un Sistema de Audio Multiroom con Mopidy y Snapcast

🎧 Complete Guide: Set Up a Multiroom Audio System with Mopidy and Snapcast

Would you like to enjoy your favorite music in every room of your home in sync? With this guide, you'll learn how to set up a multi-room audio system using Mopidy and Snapcast, leveraging a Debian 11 server and Raspberry Pi clients.

🧰 Prerequisites

Necessary Hardware

  • Server : A device with Debian 11 installed (e.g., an Intel NUC).
  • Clients : Raspberry Pi zero, 3, 4 or 5 for each room where you want to play audio. Depending on the speakers, use a DAC or directly the Raspberry Pi jack output.
  • Storage : At least 3 GB of free space on the server.
  • Connectivity : Stable network connection (LAN recommended for the server).
  • Playback Devices : Speakers or sound systems connected to each Raspberry Pi.

Required Software

  • Operating System : Debian 11 on the server and Raspberry Pi OS Lite on the clients.
  • Root Access : Required to install and configure services.
  • Mopidy : Extensible music server.
  • Snapcast : Synchronized audio transmission system.

🖥️ Step 1: Configure the Server (Debian 11)

1. Update the System

 sudo apt update && sudo apt upgrade -y

2. Install Required Dependencies

 sudo apt install nano htop python3-pip -y

3. Install Mopidy

a. Add the Mopidy Repository

 wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
 sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list
 sudo apt update

b. Install Mopidy and Extensions

 sudo apt install mopidy mopidy-spotify mopidy-mpd mopidy-http mopidy-file -y

4. Configure Mopidy

Edit the configuration file:

 nano ~/.config/mopidy/mopidy.conf

Configuration example:

 [core]
 cache_dir = /var/cache/mopidy

 [mpd]
 enabled = true
 hostname = 0.0.0.0

 [http]
 enabled = true 
hostname = 0.0.0.0
 port = 6680

 [file]
 media_dirs = /mnt/music

 [spotify]
 username = YOUR_SPOTIFY_USER
 password = YOUR_SPOTIFY_PASSWORD
 client_id = YOUR_CLIENT_ID
 client_secret = YOUR_CLIENT_SECRET

5. Configure Audio Output to Snapcast

 [audio]
 output = audioresample ! audioconvert ! audio/x-raw,rate=44100,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo

6. Install and Configure Snapserver

 sudo apt install snapserver -y

Edit the configuration file:

 sudo nano /etc/snapserver.conf

File content:

 [stream]
 source = pipe:///tmp/snapfifo?name=Mopidy&sampleformat=44100:16:2

 [server]
 threads = 4

Create the FIFO file:

 mkfifo /tmp/snapfifo

7. Start the Services

 mopidy &
 sudo systemctl restart snapserver

🍓 Step 2: Configure the Clients (Raspberry Pi 4/5)

1. Install Raspberry Pi OS Lite

Download the image from raspberrypi.com and burn it to a microSD card using Raspberry Pi Imager.

2. Enable SSH and Configure Wi-Fi (Optional)

To enable SSH:

 touch /boot/ssh

To configure Wi-Fi, create a `wpa_supplicant.conf` file on the boot partition with the following information:

 country=ES
 ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
 network={
 ssid="NOMBRE_DE_TU_RED"
 psk="CONTRASEÑA_DE_TU_RED"
 key_mgmt=WPA-PSK
 }

3. Update the System

 sudo apt update && sudo apt upgrade -y

4. Install Snapclient

 sudo apt install snapclient -y

5. Configure Snapclient

Edit the configuration file:

 sudo nano /etc/default/snapclient

Add the server IP address:

 SNAPCLIENT_OPTS="--host 192.168.1.100"

Replace `192.168.1.100` with your server's IP address. Restart Snapclient:

 sudo systemctl restart snapclient

📱 Step 3: Control Playback

You can control Mopidy from:

  • Web Interface : Access http://192.168.1.100:6680 from a browser.
  • Applications : Use MPD-compatible applications such as RompR, Cantata, or MALP (Android).

🛒 Recommended Products

✅ Conclusion

With this setup, you can enjoy a personalized, affordable, and high-quality multiroom audio system in your home. The combination of Mopidy and Snapcast offers a flexible and scalable solution for your audio needs.

Back to blog

Leave a comment