Software installation
Software installation
Tutorial: Multiroom Audio System Based On Raspberry Pi And Hifiberry
I tested different distributions to find one that easily supports the Hifiberry boards. Initially I was thinking of picoreplayer, a very lightweight distribution that supports the hardware.
But finally I ended up with Max2Play, which integrates Squeezeplug (which I presented in a previous post). There were several reasons:
- The installation is very simple: It’s enough to copy the files on the Micro SD card. There is no need to use a tool to write an image on the card—just copy-paste.
- All settings are made through a web interface—there’s no need to type terminal commands.
- Supports various useful plugins, with new ones added often.
- Features like Airplay are pre-installed.
The only thing to note: You have to buy a license for €9 to use the Hifiberry card, and it unlocks some other options for the Raspberry Pi as well. In the end, it’s not really expensive, since it’s possible to use one license for all 7 Raspberry Pis.
Update: Max2Play now provides a HiFiBerry image that can be used without a license. However, for the full feature set you still need to buy a license.
- Common installation for all Pis
All 7 Raspberry Pis have the same software basis; there are just a few differences in the end in between the clients and the server.
(At the writing of the original article, the HiFiBerry installer was not available yet. Since it makes it easier to install the distribution on the SD card and helps you with first steps setting up the system, it’s described after this part of the installation tutorial as an alternative.)
So we start by downloading the Max2Play Noobs Image from the Max2Play webpage, which, once extracted, gives you these files. It is enough to copy them on the Micro SD card.
Now it’s time to insert the Micro SD card in the Raspberry Pi and boot it (with all connections having been made before). It’s not necessary to connect a monitor—the installation is done completely automatically. Just wait for about 15 min and it’s done, but be careful not to remove the power supply during this time. When this is finished, a new device (or multiple devices, if you did them all at once) will appear in your network. Just type either its IP address or “http://max2play” (depending on your system, it might also be “max2play.local”) in your web browser to reach the web interface.
If you’re curious and attach a screen to the Raspberry Pi, it looks like this:
After the reboot, the common Raspberry Pi boot information can be seen. In the end, nothing interesting here— everything happens automatically and there’s no need for the monitor.
With the IP address (or http://max2play or max2play.local) in your web browser, the web interface is more interesting. It looks like this:
Different tabs are available to configure the device. The “Audioplayer” tab gives access to the options of the Squeezelite client, Airport (which is called “Shairport” here), DLNA, and others.
The audio output can be chosen as well, but as you can see, we can’t select the Hifiberry card—only the standard Raspberry Pi outputs are shown.
You have to buy a license on the Max2Play website, which gives access to all plugins of this software. Since just one license is needed to set up all the players, it seems quite fair.
Once you’v bought the license, you just need to go to the tab “Settings/Reboot” and enter the email address that you used to buy the license. At the same time, you could rename the Raspberry Pi (e.g., living room, bedroom, etc.). This name appears in the network later when using the multiroom system. Further, you could select the language for the desktop here as well (the web interface uses your favorite language, as you might have noticed). Don’t forget to save these settings with the button below them.
At the very end of the page, you can enter the download links of the plugins, and activate them.
We enter http://shop.max2play.com/media/downloadable/currentversion/raspberrysettings.tar to install the Hifiberry plugin and click on “Install new plugin”:
The installation is again automatic.
The only thing left to do is activate th plugin “Raspberry Settings” now by selecting it in the list, and then click the button “>” to move it to the active plugins, and save the setting with the button just below.
A new tab “Raspberry Settings” appears, where we can find a list to select the Hifiberry board. As we can see, all the different models are supported:
If you’d like, you could also overclock the Raspberry Pi here, but it isn’t necessary.
Once this is done, we get the message that we can’t use the Hifiberry board with multiple players simultaneously. In other words, it doesn’t work with Squeezelite and Shairport at the same time. But don’t worry, we’ll use the trick that max2play is telling us about in the same notification.
For making the board available to Squeezelite, reboot the Raspberry Pi by using the “Reboot” button in the “Settings/Reboot” tab.
Once it’s back, select the “Audioplayer” tab and select “Edit Advanced Options“ of Squeezelite:
Select the Hifiberry board (the one with “sysdefault” in the name). In the ALSA parameters, I entered “2000:4::” which gives me 2000 ms cache to avoid interruptions during playback.
Disable the “Autostart Shairport (Airplay)” as well, since we don’t need it anymore.
Further, it’s very likely that an update of Max2Play will be proposed, which you can do in the “Settings/Reboot” tab.
All these changes need to be made for each of the Raspberry Pi’s. Someone who knows how to make a copy of the SD card image could copy it easily to the other ones, but the steps described here don’t take very long.
Now for the small differences between the players.
Alternative installation using the HiFiBerry installer:
The easiest way to install the software on the SD card is using HiFiBerry’s installer. Some of the steps described above can be skipped by using it, since the installer configures them by itself. The installer exists for Windows and Mac. Just select “Max2Play” as your distribution in the first step, and this will automatically write the Max2Play Hifiberry image on the card.
Once this is done, insert the card in the Raspberry Pi and power it. You immediately have access to the web interface by typing “http://max2play” (depending on your system, this might also be “max2play.local”), as described above.
There, as the first step, you’re asked which HiFiBerry product you use. Select it from the menu and save this setting. Just below, you can select how you want to use your media player. Since we want a multiroom solution, we need to select the second option, “Advanced”. After this, go to the “Settings/Reboot” tab to update the system using the “Update Max2Play” button and reboot using the “Reboot” button. After a few seconds the system is back.
After this is done, continue in the process as described above by entering the license code. The settings in the tab “Audioplayer” are already preconfigured.
Please note: Using this process instead of the Noobs image (described above) gives you an additional tab in the web interface, which is called “Hifiberry”. Here you can select the HiFiBerry board you use—it isn’t part of the “Audioplayer” tab anymore.
2. Server installation
Since I have a Synology NAS in my house, one could ask why I didn’t just install the Squeezebox server directly on the NAS. Well, I tried it out, but was having some trouble getting Airplay working.
Max2Play supports Shairport, which easily brings Airplay to the Raspberry Pi, but it isn’t possible to use Squeezelite and Shairport at the same time—and sure enough, I get no sound with the latter one. But since it’s possible to install various plugins on a Squeezebox system, we use this possibility to install Shairport as a plugin. That way, everything is managed by the Squeezebox server, the sound is switched automatically as desired. My problem: This plugin is a bit difficult to install on my Synology, since some command codes need to be run in a terminal. Even though there are tutorials out there, I couldn’t get it working proplery, and whenever the Synology gets an update, these installations would need to be done again, which isn’t very practical. That’s why I finally decided to install the Squeezebox server on a Raspberry Pi as well, and in order to have no performance problems, I took the Raspberry Pi 2B (this one will act both as server and client). And who would’ve thought—just like that, the plugin installs itself nearly alone, since it’s provided by Max2Play.
For installing the server part, we need to select the “Squeezebox Server” tab and click on “Show available versions” to display the different version of LMS (Logitech Media Server) that we can install, and then click on “Squeezebox Server start installation”.
This installation needs a few minutes, but is automatic.
Make sure you check “Autostart Squeezebox Server” so the server boots when the Raspberry Pi is switched on.
Finally, select the “Shairtunes Plugin”at the bottom and click “Install plugin” to start the automatic installation of the Airplay plugin.
Last step: I have all my music on my NAS, so I need to add the network share option. For this, select the tab “Filesystem Mount”, add the network path to the music folder location, with its mount point on the Raspberry Pi, and then the password to connect to your network folder.
If you don’t have an NAS, just plug a hard drive into the USB port of the Raspberry Pi that runs the server.
Then, restart the Raspberry Pi. When it’s back, open “Open Squeezebox Server Webadministration” in the “Squeezebox Server” tab to access the control interface of the Squeezebox system. This is the first time the system asks you where your music is located, and you’ll select the previously mounted folder.
Go over to the “Settings” on the very bottom right, and select the tab “Plugins” and make sure the Shairtunes plugin is activated to be able to use Airplay.
If you want Spotify support as well, uncheck the original “Spotify” plugin and check the “3rd Party Spotify Plugin” of Triode, which works much better (if you can’t see it, select “view third party plugins”). However, you’ll need a Spotify premium account to use Spotify with the Squeezeboxes. Click “Settings” next to this plugin to enter your Spotify account details.
These two plugins allow you to use both Airplay and Spotify on all the the connected Squeezeboxes!
That’s all for the server.
3. Client installation
We complete the installation of the Raspberry Pi’s with the plugin “SD card write protection”. This plugin sets the SD card into read-only mode to protect the system against overwriting or power cuts, so the card won’t get corrupted.
We return then to the “Settings/Reboot” tab of the Max2Play configuration and add the link http://shop.max2play.com/media/downloadable/currentversion/sdcardprotection.tar to the plugins to install, and click “Install new Plugin”.
As always, the installation runs automatically.
A new tab “SD Card Protection” appears, where we need to click “Install” to activate the plugin.
To confirm the plugin is running, it now displays “enabled”.
In all of the tabs, a yellow note is now reminding us that the SD card protection is active. If you ever need to change anything again, just return to the tab “SD Card Protection” and enable writing until the next reboot.
Warning! Never install this plugin on the Raspberry Pi that runs the server, since the server won’t work anymore. If you’ve done this, you’ll need to uninstall the plugin.
<< Installation in the switch cabinet Using the Multiroom System >>