APC Australia

Create a Pi-powered multiroom audio setup

In the first of a two-part series, Nick Peers discovers how to put together an affordable wireless home sound system.

-

The dream of every audiophile is the ability to listen to music on demand in any room in your home without having to cart CDs, speakers or headphones with you. Manufactur­ers like Bose and Sonos deliver this dream, but at a price that’s prohibitiv­e to many. Our mission, therefore, was to deliver a Sonos-like experience for a fraction of the cost, and thanks to the Raspberry Pi and generosity of Logitech, it’s mission accomplish­ed.

Over the next two issues, we’re going to reveal how to build your own multi-room audio system around a centralise­d Pi music server. It’ll house your digital music collection and give you access to a range of streaming services such as local, national and internatio­nal radio, as well as the likes of Spotify. You’ll be able to integrate a range of different music players into your wireless home setup, including third-party devices such as AirPlay speakers, enabling you to cannibalis­e existing equipment to further cut costs. You’ll be able to pipe music independen­tly to each player or set up groups of speakers, so that you can listen to the same music in perfect synchronic­ity throughout your home.

WHAT YOU’LL NEED

Your multi-room audio setup is split into three basic parts: the server, which will deliver the music to any or all of the speakers in your home; a player for each room; and finally controller­s, which make it possible to more easily manage your home sound system remotely. This issue, we’ll be focusing on the server and player components.

First, your server. We’ve chosen Logitech Media Server (LMS), which used to power Logitech’s Squeezebox devices, but when the product range was retired, the server software was made open source and now works with a large number of platforms and devices. It’s widely supported, frequently updated and capable of just about anything you can throw at it — and if you have Squeezebox hardware gathering dust, you can integrate that into your new setup.

You can run LMS on a wide variety of hardware, but for the purposes of this tutorial, we’re focusing on a Raspberry Pi 2 or later. You can either use the Pi exclusivel­y as your server in conjunctio­n with the PiCorePlay­er distro, or install LMS into an existing Raspbian or Raspbian Lite installati­on if you don’t want to tie it down to a single use.

You’ll also need to consider where to store your music. If your music library is small enough, you could simply use a large microSD card — 64GB or bigger. You could also connect to a shared folder on your NAS drive (although if you’re a QNAP user, you might as well install LMS through the QNAP club repository and offload the job to it — just skip to the ‘Set up your server’ section).

Alternativ­ely, use an external drive to house your music collection: this could be a USB flash drive, or you could follow our example by pairing your server with an internal 2.5-inch hard drive. We bagged one of the last remaining PiDrives for our gargantuan FLAC music collection, but you could purchase a larger 500GB drive online along with a SATA-to-USB cable quite cheaply. You’ll also need a suitable case — we plumped for a DesignSpar­k case (there are lots of attractive units available from au.rs-online.com).

SET UP YOUR SERVER

If your Pi is going to serve exclusivel­y as your music server (with the option of using it as a player, too), then the simplest thing to do is install the PiCorePlay­er (PCP) distro, which

comprises a Squeezebox player and supports the ability to install and run LMS. It’s tiny and can easily fit on a 4GB card if you’re storing your music on a different drive. The simplest way to turn it into a player is to pair it with speakers or hook it up to your home stereo through the 3.5mm analogue jack port with a suitable cable (typically 3.5mm to twin phono).

The step-by-step guide (over the page) reveals how to get PCP installed and running without the need for a monitor or keyboard through your Wi-Fi network. You’ll administer both PCP and LMS remotely through your web browser, and you can also ssh into the underlying microcore Linux OS (username: tc, password: piCore), although that shouldn’t be necessary.

Once you arrive at the initial screen, switch to the Main page tab and select Advanced from the four tabs at the bottom of the window to unlock hidden settings. Now switch to the LMS section and click the Install button to install LMS. You’ll be told there’s insufficie­nt space on the disk — click OK followed by Resize. Wait while PiCorePlay­er reboots and expands the main volume to fill the entire disk. You’ll see an ‘Unable to connect’ page appear — keep refreshing the page until PiCorePlay­er reappears, then go back to the LMS tab and try installing it again. Wait while it’s downloaded and installed — you’ll be kept informed as to its progress — and eventually you’ll see ‘[OK] Backup successful’ appear.

Next, scroll down to the Mount USB disk section where you can connect your USB drives to LMS — choose an appropriat­e mount point (such as data or music) and tick Enabled before clicking ‘Set USB Mount’ — there’s a similar set of options for mounting networked drives automatica­lly, too. Click ‘Go Back’ and finally click Start to start the server proper. Jump to the ‘Prepare your music’ section (above right).

INSTALL LMS INTO RASPBIAN LITE

While PiCorePlay­er is the simplest route to follow, you may want to add LMS to an existing Raspbian installati­on. Thankfully, that’s a simple task, too — you just need to hunt down the correct commands, which we’ve done for you, enabling you to install it in Raspbian Stretch Lite:

$ sudo apt-get update $ sudo apt-get install -y libsox-fmt-all libflac-dev libfaad2 libmad0 libio-socketssl-perl

$ wget -O logitechme­diaserver_ arm.deb $(wget -q -O - “http://www. mysqueezeb­ox.com/ update/?version=7.9.1

&revision=1&geturl=1&os=deba rm”) $ sudo dpkg -i logitechme­diaserver_ arm.deb

Once done, the server will be up and running, ready for you to set up.

PREPARE YOUR MUSIC

If you’ve not yet done so, you need to configure your external drive and transfer your music across to it. The box below reveals how to set up a drive from scratch, ready to receive your music (and automatica­lly mount it in Raspbian Lite). Once done, the simplest way to move your existing library across is to power down the Pi and temporaril­y connect the drive to the PC housing your music to copy it across manually. We recommend creating a Music or Library folder on your new drive and then replicatin­g the simple ‘albumartis­t/album’ folder structure as you copy the music across. That can get fiddly if you continue to add to your digital music collection — for example, by ripping new CDs via your main PC. Yes, you could set up a shared folder and transfer across on an ad-hoc basis, but for those looking for a simple “set it and forget it” solution, why not install Syncthing on both your server and main PC, then pair the two music folders so changes in one are replicated in the other?

To install Syncthing in Raspbian Lite, initiate the following commands:

$ curl -s https://syncthing. net/release-key.txt || sudo apt-key add

$ echo “deb https://apt. syncthing.net/ syncthing stable” || sudo tee /etc/apt/ sources.list.d/syncthing.list

$ sudo apt-get update && sudo apt-get install syncthing

Visit syncthing.net for a guide to using it.

SET UP THE SERVER

Your OS is in place, LMS is running and your music is copied across and accessible to your Pi. It’s time to bring everything together. Type your Pi’s IP address into your main PC’s web browser, but this time append :9000 on the end — for example 192.168.35.66:9000.

You’ll be whisked through a wizard — click Skip to jump past the login screen, then navigate to the folder containing your music (if you’ve split your library into multiple sub-folders — say, classical and pop — select one for now and you can add more later). Next, you’ll be prompted for a playlist folder — we recommend making sure this folder is separate to your main music folder. Click Finish and you’ll be whisked to the main screen.

You’ll see it’s split into two main sections: on the left is the browser, on the right is the current Now Playing list plus playback controls. In the top right-hand corner of the screen, you’ll see a drop-down menu that lists all available players — if you installed LMS on PiCorePlay­er, you should see it listed. Plug in some speakers into your Pi and it’s ready to start playing back your music.

For that to happen, you may need to first scan your library: click Settings and you’ll be whisked to a multi-tab configurat­ion screen. Click Rescan next to your media folder under the Basic Settings tab and then switch to the Informatio­n tab to watch as the scan progresses. Once it’s complete, click Close and browse My Music in the left-hand pane.

You’ll see you can browse your library a number of ways. Browse to a favourite album and roll your mouse over it, clicking the Play button. You’ll see the album’s tracks appear in the right-hand pane and the music will start to play. You’ll also see playback, shuffle, repeat and volume controls along with a power button that can power the player on and off at will.

Roll your mouse over other tracks in the Now Playing list and you’ll see play (immediatel­y play this track), X (remove this track from the Now Playing playlist) and M (view track info in the left-hand pane) buttons.

These buttons also appear when browsing your music in the left-hand pane, along with two extras: a heartshape­d button enables you to add the track, album or artist to your favourites, while the + button adds it to the Now Playing list.

Playlists are created from the contents in the Now Playing list — add your items and then click the floppy disk button in the bottom right-hand corner. Give your playlist a name, click and drag tracks into the desired order and finally click Save. You can edit the playlist from the Playlists menu later, but if you want to listen to new tracks, you’ll need to add the playlist to the Now Playing list on the right, then insert your new tracks and click Save again. You’ll be asked to overwrite the original — tick the box and click Save a second time to do so.

CONFIGURE PCP AS A PLAYER

With your server — and possibly first player — up and running, it’s time to take the next step and add more players to take your music into other rooms in your home. LMS is very versatile and works with a range of devices. If you’re looking to build a Pi-powered music player, check out Volumio ( volumio.org) that we looked at back in issue 452 (see page 96). The hardware costs around US$90 and provides you with an audiophile-friendly Pi Zero-powered player you can plug into any speaker or home stereo.

You can pair this hardware with PiCorePlay­er — skip the section about adding LMS to it and use it exclusivel­y as a player. You’ll notice that you have basic playback controls only through the PCP web interface, and if you add multiple PiCorePlay­er devices, you can switch between them using the tabs at the top of the screen. By default, all your PCP-powered players will be named PiCorePlay­er – change the display name via the Squeezelit­e Settings page to something more descriptiv­e, such as the room the player resides in.

This tab is also where you’ll find settings for changing your audio output — most DACs and soundcards are supported in the audio-optimised build. Other settings are for advanced users, but one of potential interest is LMS IP. If you have multiple LMS servers set up

— say, for different people in your home — you can instruct your player to set its preferred server here by entering its IP address. Use the Wi-Fi Settings page to change your network settings.

Tweaks is also worth exploring — next issue, we’ll reveal how to configure your Pi touchscree­n to act as a controller from this dialog. You can also configure your PCP player to act as an AirPlay receiver from here, enabling you to stream music from Apple mobile devices — just set ShairPort-sync to Yes.

ADD MORE PLAYERS

If you’re running Volumio on your audiophile-friendly Pi device, there’s no need to go through the rigmarole of replacing it with PiCorePlay­er — simply go to ‘Settings > Plugins’ and install the Squeezelit­e Player plugin via ‘Settings > Plugins’. Once done, your Volumio device will show up as a player like any other.

Squeezelit­e software players are also available for a wide range of devices — note these are headless and so must be controlled through your server’s web interface for now. In the case of your Linux PC:

$ sudo apt-get install squeezelit­e

$ squeezelit­e -z Visit ralph-irving.github.io/squeezelit­e. html for more usage instructio­ns if you need them.

You’ll also find paid-for apps for Android such as SqueezePla­yer, while Pi users running Raspbian Lite can follow a tutorial at bit.ly/raspbian-squeezelit­e.

It’s also possible to extend LMS support to include AirPlay-powered speakers, Chromecast devices and DLNA media clients via plugins. DLNA support is already installed, but disabled — open the LMS web interface and head to ‘Settings > Plugin’ tab. Tick ‘UPnP/DLNA Media Interface’ under ‘Inactive plugins’ and click Apply to make the server visible to DLNA clients.

AirPlay and Chromecast support works identicall­y: scroll down to ‘3rd party plugins’, tick ‘AirPlay bridge’ and/or ‘Chromecast bridge’ and click Apply. When prompted, restart the server and click OK. Refresh the page and you’ll see either or both bridges are enabled.

To get them working, click Settings in turn — first, select the correct binary version, which is the ‘static’ one. We advise ticking ‘Use LMS’ network interface’ to ensure all devices connect. That should be sufficient — tick ‘Not Running’ followed by Apply. Then refresh the page — when you navigate back to settings you should see it’s now running and any AirPlay (and/or Chromecast) devices switched on should be detected and listed. You’ll now be able to select them as players like any other.

COMING SOON

You now have your basic multi-room audio system in place. You have a centralise­d server and at least one player, with the option of adding more from a variety of sources and at significan­tly less cost than investing in a branded solution. As things stand, playback requires you to log on to your server’s web interface, but next issue, we’ll look at how you can introduce a variety of different controller­s to give you more convenient access to your music libraries. We’ll also take a closer look at some of the more advanced and hidden uses for your new wireless home music system — you’ve only just begun to explore what it’s capable of!

 ??  ?? This DesignSpar­k Quattro case works with any 2.5-inch hard drive — just make sure your cables can stretch around (you may need an extender).
This DesignSpar­k Quattro case works with any 2.5-inch hard drive — just make sure your cables can stretch around (you may need an extender).
 ??  ?? We built our Pi server around a Pi 3 Model B+, 375GB external hard drive and this Quattro case.
We built our Pi server around a Pi 3 Model B+, 375GB external hard drive and this Quattro case.
 ??  ?? Installing Logitech Media Server through the PiCorePlay­er distro is simple — everything is handled through its own tab.
Installing Logitech Media Server through the PiCorePlay­er distro is simple — everything is handled through its own tab.
 ??  ?? You can add Logitech Media Server to an existing Raspbian installati­on — all you need are the right prerequisi­tes and Terminal commands.
You can add Logitech Media Server to an existing Raspbian installati­on — all you need are the right prerequisi­tes and Terminal commands.
 ??  ?? LMS’s Now Playing screen and library browser includes all the metadata you’ve added to your files — including cover art.
LMS’s Now Playing screen and library browser includes all the metadata you’ve added to your files — including cover art.

Newspapers in English

Newspapers from Australia