Linux Format

Audio streaming.....................

Nick Peers, LinuxForma­t Towers’ resident DJ, reveals how to set up a Pi-based streaming music player that plays as well as it looks and sounds.

-

Nick Peers reveals how to set up a Pi-based music player running the awesome Volumio, that plays as well as it looks and sounds.

We’re going to transform your Raspberry Pi into a music player with Volumio, a distro that has just one job: playing and streaming music. It’s relatively easy to set up, is designed for headless use and provides a user-friendly interface through your web browser for managing your music. This UI is replicated on the official Volumio apps for iOS and Android, so you can run everything from your mobile, too. It costs 99p on each platform, but you can access Volumio through your mobile browser, or try a MPD-capable app such as MPDroid for Android instead. Note, however, that MPD apps can be fiddly to set up (connecting using IP address rather than hostname is more reliable).

Volumio also doubles up as a UPNP/DLNA and AirPlay receiver, and can be used to stream music over the internet, with built-in support for web radio and plugins for streaming from Spotify and YouTube too. Volumio supports the most popular audio file formats out of the box – including FLAC for those of us who have an aversion to lossy compressio­n – and has native support for a wide range of I2S DACs for those who want to take their listening pleasure to the next level.

The cable guy

The basic equipment you’ll need is your Raspberry Pi or Pi Zero, a 4GB or larger microSD card, and a cable capable of connecting your Pi to an amplifier or your home stereo system. First check the connection­s on the back of your amp – typically this will be in the form of two phono sockets, in which case you can connect your Pi’s headphone jack to here using a suitable cable: 3.5mm plug at one end, and twin phono plugs at the other. If you can’t source one locally, try www.lindy.co.uk – a 7.5m cable (part number 35497) costs around £8.50 including delivery. If you only have access to a HDMI port, then search eBay for “HDMI audio converter” for a solution costing around £12-15 (cable purchased separately).

If you want to take your music to the next level, then invest in a DAC (Digital to Analogue Converter) HAT for your Pi or Pi Zero. There are plenty of options out there, but we’re fans of the DACs offered by www.iqaudio.co.uk. The box ( overleaf) reveals how to source your own Pi Zero-powered audiophile­friendly music player for around £60. The cost can be reduced dramatical­ly if you’re able to repurpose components like the Pi Zero W, power adapter or microSD card.

Get Volumio working

First, open your browser and visit https://volumio.org/getstarted to download the Raspberry Pi build of Volumio. It’s around 300MB compressed. Once done, follow the main step-by-step guide ( seethefina­lpage) to copy this to a blank microSD card (4GB or larger) and then complete the initial setup process. At no point will you need to connect your Pi to a monitor or keyboard – this is because Volumio is configured and accessed through any web browser connected to your local network.

You’ll be prompted during the setup process to select the folder where your music is stored. Volumio can handle multiple folders stored across a variety of different locations, including on the microSD card itself (you’ll be looking to invest in a 64GB or even 128GB card if you go down this route, particular­ly if you’re a fan of the audiophile-friendly FLAC format like we are). Because the SD format is prone to corruption, however, we’d recommend storing your music separately to Volumio. Suitable alternativ­es include USB storage plugged directly into your Pi – typically either a USB flash drive or a USB hard drive if your music collection is on the large side. If you’re connecting to the Pi Zero then you’ll need a USB adaptor or shim, and furthermor­e the USB drive will need to provide its own power.

A more convenient option is to connect to network storage, which is a good way to access music stored on your main PC or a NAS drive. Volumio will automatica­lly look for network drives alongside any locally detected storage. Don’t panic if your drive doesn’t show up: simply enter its IP address or network name along with the path to your shared music library. Use Ubuntu’s File Manager to determine its name and path if necessary.

The initial scan will take some time, particular­ly on the Pi Zero and whether libraries are both large and stored externally. Once initial setup is complete, your browser should

redirect you to the main Volumio playback screen. You’ll see that it’s split into three tabs: Browse, Playback and Queue. They’re all self-explanator­y, so start by clicking Browse where you’ll see you can navigate your collection. Look out for the spinning wheel at first. This indicates that your folders are still being scanned for content.

Configurat­ion options

While you wait for the initial scan, click the Settings button in the top-right hand corner of the Volumio window to find a range of configurab­le options. Start with My Music, where you can add new drives to your library. You can also tweak other preference­s here, such as whether to download album art from the web, for music folders without art in them. Consider switching this off if your album art is embedded directly into each music track (you’ll also need to flick the Show Embedded Albumart switch on and then click the Reset Album Art cache button. If you find that certain artwork comes up missing or corrupt, chances are there are hidden folder.jpg files in the album folder downloaded from the web. See the tip ( below) for how to locate and remove these.

Select Playback Options to change your output device and adjust related settings. Explore Playback Options if you experience frequent buffering when listening to music over the network. Increase the Audio Buffer Size to 12MB and consider upping the ‘Buffer Before Play’ figure. You can tweak Volumio’s volume options from here too, such as setting a default volume on startup or limiting the maximum volume level.

The Appearance settings affect the web (and Volumio app) interface, enabling you to change language, select a background image (or upload your own) or choose a plain background colour. Access Network Settings to configure the wired and wireless interfaces – typically to establish a static IP address. You can disable the built-in Volumio Wi-Fi hotspot from here for security reasons. Furthermor­e, there’s an option to choose different DNS settings if you’re struggling to get internet access, such as those offered by OpenDNS (208.67.222.222 and 208.67.220.220).

Select System to re-run the first configurat­ion wizard, change your player name (handy if you have more than one Volumio-based music player), perform a factory reset, delete your user data and check for updates. A word of warning about this final option: it may corrupt your SD card, so back up any user data on the card before you begin. We’ll tackle this at the end of this project.

Once backed up, open Volumio and switch to the Browse tab. You’ll see several options for browsing your library: you can navigate by artist, album or genre (if your files have been correctly tagged), or choose Music Library to browse by location. This comes in handy if you’ve set up multiple folders and are only interested in browsing a specific one (for example. your classical music collection).

Over time your music folders will change, of course. You’ll add new tracks and perhaps remove others. You may also wish to manage the metadata associated with your tracks – both tags such as artist, track name, album name and so on, together with artwork. None of these changes are automatica­lly recognised by Volumio; instead, you’ll need to manually rescan or update your library. The difference is straightfo­rward: update searches for new, changed or removed content, while rescan scans all the files in your library for changes.

If you’ve updated a specific artist or album then you’ll also find a handy ‘Update Folder’ option on the menu next to its entry. This enables you to perform a focused scan on that part of your library.

Browsing and management

You’ll also see options for browsing by Favourites and Playlists. Favourites contains a list of your best-loved tracks – these can be added manually via other views (or the queue tab) by clicking the button next to a track and choosing ‘Add to Favourites’. Once added, just click the button again and choose ‘Remove from Favourites’ when you become sick of listening to the song.

Playlists offer more flexibilit­y, as you can generate these from entire albums and even artists as well as individual tracks – see the box ( aboveright) for more informatio­n on managing playlists.

Two final options include ‘last 100’, which basically lists the

most recently listened to tracks. This is a convenient way to quickly collate these into one place for the purposes of creating a playlist or favouritin­g specific tracks. Then there’s ‘Web Radio’, which gives you access to hundreds of online streaming radio stations.

Online streaming

Web Radio utilises Shoutcast and Dirble services for tracking down and listening to radio stations worldwide. Shoutcast offers a choice of the top 500 radio stations or the ability to browse by genre; Dirble offers a browse by country function. Click a radio station to start listening, adding it to the queue or make it one of your Radio Favourites.

You can also manually add radio streams yourself by clicking next to My Web Radios and choosing Add Webradio. Give your stream a name, then enter its URL stream or link to M3U or PLS remote file. Most people want to add BBC radio to their lists – the following syntax works for national radio stations: http://bbcmedia.ic.llnwd.net/ stream/bbcmedia_radio1_mf_p

Substitute radio1 with the name of your national station, such as radio1xtra, radio2 or even radio4fm or radio4lw. For nations and regions, use the following: http://bbcmedia. ic.llnwd.net/stream/bbcmedia_scotlandfm_mf_p Examples include cymru, foyle, ulster and wales. Finally, type the following to listen to local radio: http:// bbcmedia.ic.llnwd.net/stream/bbcmedia_lrderby_mf_p

Other examples include lressex, lrleics and lrbris. Then click My Web Radios to listen to your stations.

Two additional streaming services – Spotify (Premium account required) and YouTube – can also be added via Settings>Plugins>Search Plugins. Once installed, switch to the Installed Plugins tab to switch them on. You can then access them from the home screen under Browse and access the content as if it were your local library, adding it to queues, playlists and favourites (a handy search tool helps you to quickly locate content). The major difference between local music and streaming is the noticeable delay between clicking on a stream and it actually starting.

Beyond the basics

Plugins enable you to extend what Volumio can do. There are currently around 10 available from Volumio’s Plugins, split into four categories. Spotify and YouTube are currently the only additional Music Services on offer from here – but check the final tip ( right) for details of another source for plugins.

The Miscellane­ous and System sections include five plugins that extend support to various hardware add-ons. Of most interest will be the Touch Display Plugin for those who’ve hooked up their Pi to any touchscree­n display (it’s optimised for the seven-inch Raspberry Pi display), plus GPIO Buttons, which enables you to control basic playback buttons through physical buttons.

Finally, the Accessorie­s section contains an IR Remote Controller plugin for controllin­g Volumio playback via remote control. It’s configured for JustBoom IR Remotes, but also offers profiles for Odroid Remote and Apple remote too. Don’t forget that you’ll need an IR receiver for your Pi.

The final plugin should be considered essential: Backup & Restore Data. Once installed, switch to the Installed Plugins tab to activate it, then click Settings where you choose what to back up. Your available options are Queue, Playlists, Favourites, Configurat­ion data and Album Art. Click Backup and a file called volumio_data.tgz will be saved to Volumio’s shared folder.

Once saved, go into File Manager>Network>VOLUMIO> Internal Storage – log on anonymousl­y when prompted, then save volumio_data.tgz to a secure location. After restoring Volumio and reinstalli­ng the plugin, be sure to copy this file back to the root directory of Internet Storage, then click the Restore button to put things back in place.

You can use the Backup and Restore plugin to do more than simply provide a fail-safe in case of SD card corruption; you can also use it as a crude snapshot tool. About to make a major change to your database? Take a backup and then simply restore it if things don’t go to plan.

 ??  ?? Browsing your music collection is – mostly – a pleasure. Corrupt artwork can be fixed with the help of our tip.
Browsing your music collection is – mostly – a pleasure. Corrupt artwork can be fixed with the help of our tip.
 ??  ?? The Playback tab contains shortcuts alongside the obligatory playback controls.
The Playback tab contains shortcuts alongside the obligatory playback controls.
 ??  ?? We love the default Volumio skin, but if the record-store look doesn’t appeal, you’ll find plenty of alternativ­es under Settings>Appearance.
We love the default Volumio skin, but if the record-store look doesn’t appeal, you’ll find plenty of alternativ­es under Settings>Appearance.

Newspapers in English

Newspapers from Australia