Multi-Room Audio System with Raspberry, Icecast and Volumio

With the advent of the new Raspberry Pi model 2, the more cycle-consuming applications now have a briljant performance.
Building on the work of others I have now configured a narrow-casting intranet in-house music system, with the Model 2 as the server and 4 model 1’s as the clients, using MPD, MPC and Icecast on the Server Pi and Volumio on the client Pi’s. This allows me to play the same music from my NAS music server simultaneously throughout the house. See attached file for picture of configuration.

Here is how I did it:

  1. Raspberry Pi model 2 with Raspbian

  2. Package installation
    sudo apt-get install mpd mpc icecast2

  3. Change in /etc/mpd.conf:
    sudo nano /etc/mpd.conf

For network

bind_to_address “192.168.x.xxx” #your raspberry ip address

comment the following line:

user “mpd”

  1. Configure MPD
    sudo nano /etc/mpd.conf

audio_output {
type “shout”
name “Icecast”
host "192.168.x.xxx” # your raspberry ip address
port “8000”
mount “/mnt/music” # or whatever your NAS is mounted to, see further on.
password “hackme” # set to your password
quality “10”
format “44100:16:2”
encoding “ogg”
}

  1. Comment all lines in alsa output

  2. Restart MPD to load these changes
    sudo /etc/init.d/mpd restart

Icecast2 will start up by default, or can be restarted with:
sudo /etc/init.d/icecast2 restart

  1. Set permissions:
    sudo chmod g+w /var/lib/mpd/music/ /var/lib/mpd/playlists/
    sudo chgrp audio /var/lib/mpd/music/ /var/lib/mpd/playlists/

  2. Create directory ‘music’ in directory ‘mnt’
    sudo mkdir /mnt/music #or whatever name you prefer
    sudo chmod g+w /mnt/music

  3. Mount NAS:
    nano /etc/fstab

//192.168.x.xxx/share/music /mnt/music cifs username=name,password=password,iocharset=utf8,sec=ntlm

adapt to the ip of your NAS and your username and password

  1. Control mount with:
    sudo mount -a

  2. Make symbolic link:
    cd /var/lib/mpd/music
    ln -s /mnt/music music

  3. Start mpd
    mpc update
    mpc ls | mpc add
    mpc playlist
    mpc repeat on
    mpc random on
    mpc crossfade 2
    mpc play

  4. On Raspberry Pi ONE: in order to run smoothly adapt the following (overclocking always at your own risk). This is not necessary on a Raspberry Pi TWO.

sudo nano /boot/config.txt

arm_freq=1000
core_freq=500
sdram_freq=500
over_voltage=6
gpu_mem=16

  1. Make playlist for Volumio in your text editor with the name Icecast.pls:

Icecast.pls

[playlist]
numberofentries=1
File1=http://192.168.x.xxx:8000/mnt/music # IP address of your Raspberry Pi
Title1=Icecast

  1. Copy playlist to your Webradio folder in Volumio

  2. Start Volumio on your Raspberry Pi client and choose Webradio / Icecast.

  3. Repeat this on all your Raspberry Pi’s and you will have a Multi-Room Audio System, playing the same music throughout your house.

  4. MPD Server Management
    Raspberry Pi: mpc
    Windows: Auremo
    Android: DroidMPD

  5. Issues
    Uncontrolled shutdown of Icecast MPD Server can block the music folder on the NAS music server:
    Correct with:
    sudo chmod g+w /mnt/music # or whatever the name of your mount is.
    Or, if that is not compliant with your setup, you can also:
    sudo chmod -R 744 /mnt/music

Have fun.
MPD%20Icecast%20Configuration.jpg

If you have 2 devices playing through speakers, and you are somewhere in the house where you can hear both, do they stay in sync?

Yes, synchronization is important and can only be achieved by configuring your time servers as closely as possible to your physical location. So, for instance, if you are living in France, Google for NTP servers in France and then configure your ntp.conf file to reflect that, like:

sudo nano /etc/ntp.conf
and then: add your local timeservers.

Closer is better.
I have good results with that. The synchronization in my situaton is near perfect.

Thanks Wim?
Based on your idea, I took a similar approach, but added it as an additional audio_out to mpd.conf in an existing volumio setup.
Next to 2 PIs, there also a Squeezebox Boom in the network, but it cannot handle a quality “10” OGG stream.
As I really want to keep the highest possible quality for the PIs, I’m going to try if if a second audio-out with a lesser quality will solve this for the SB.
My ODROID-X2 should be powerful enough to do several different outputs as the CPU is not hitting 50% yet with playing local and streaming to the PIs.

Regards - Gé

Hello,

Why not use Volumio on the Pi2? wouldn’t it be possible as well?

thank you.

paul

Very interesting and just what I need. Please can you clarify why the NAS is shown connected to both the Intranet Router and Pi-2 server?
I have recently acquired my first PI-2 and have had some difficulty in getting audio from my NAS. Maybe your answer will help me. Certainly you have inspired me to buy a second Pi-2 and follow the same route - Thanks

the nas is connected to the intranet router in order to enable the individual raspberry/volumio players to pull music directly from the nas, enabling each raspberry to play the music of its own choice. the connection to the pi2 mpd sever however, is to play the music from the icecast narrowcast system, in fact acting as my personal in- house radio, playing from the nas playlists. this mode enables all raspberries to play the same music synchronized through the whole house

@wim, thanks very much for the diagram! Helps to explain so much. Aside from playing mp3 files throughout the house, how options are available for playing podcasts? How do you add new podcasts, view available episodes, etc…?

I’ve always liked stitcher for podcasts. I wish I could use that as the podcast interface but pipe it through the whole house audio.

Hi all,
I’m aware that this thread is rather old already. Still, I wanted to thank you for this great post. I tried the proposed set up with three raspi2 and 3 running volumio2 and I have to say it works like a charm. While I type this all three raspis are playing the same song in the kitchen, the living room and the living room extension. To my surprise all three are perfectly in sync. Once again thank you for this post!
All the best
A very happy Multiroomer

Anyone like to comment on this vs. the snapcast server documented elsewhere?

Hi Gé,

I’m looking for a similar solution. Running the Icecast server on my main Volumio setup and if needed/wanted stream it to a second one. Thus, my question, are you able to do two audio_outputs on your Pi2? Can it play local sound, and simultaneous stream to a second pi? If so, what config did you use and how do you choose to use both on the Pi2?

Regards

Ruud

Hi Ruud,
this has been ditched ages ago as I only used it as a proof of concept (and got rid of all my PIs), otherwise I could have shown you the mpd configuration.
With Volumio 2 this is going to be tricky, as the mpd configuration file is handled by volumio.
Anything you add or change is potentially lost when Volumio decides to rewrite the config.

I’m waiting with multiroom until I move house. By then snapcast should be implemented in Volumio (so I hope) .
Still, the icecast approach is a nice one, but difficult to tell if the receivers are really in sync when the rooms are further apart (as in my case).
-Gé-

Thanks Gé,

Yesterday I also stumbled upon Snapcast. I will investigate that options (and probably be patient for a plugin or so…)

Regards,

Ruud

Hi guys,
today i tried out to configure the server with icecast, mpd and mpc.
I followd the introduction on a new installed jessi rasbian RPi 3 and cant get the following points from 12.
If i want to update mpc ("mpc update) i already get: “error: Connection refused”

I am a newbe on linux an RPi and googled this point but didn’t get any answer.

Can anyone of you helped me out?

Thank you very much.

Sorry, not an answer to the last question, but I guess most people on here are thinking in terms of snapcast for multiroom, synced play. Indeed, it is planned to be included in Volumio at some point. If you are interested in trying this, then you may wish to have a look at Saiyato’s Snapcast alpha plugin on Github.

I just created the first working package, configuration should work and you can en- or disable the server and/or client.
Switching between streams is problematic (e.g. you can patch your startconnect for spotify-web, but switching between spotify-web and mpd will take a few seconds). Since the topology in the first post didn’t include Spotify I suspect this is not a problem.

If you want to switch between local and remote play, just edit the volumio-host in the plugin setting, it will automatically restart the snapcast daemon; effectively changing the source.

Even neater would be to add a streaming button next to play… Or something like that, oh well, maybe in the future.

If you have any questions just ask, if you are experiencing issues I must encourage you to update the github page and log an issue. That way thing won’t get lost, I’m prone to unintended forgetfulness lately. :wink:

Cheers