Raspberry Pi music player. Software

To successfully play digital music though my HiFi several software components play a part.

Music Box - Now playing
Music Box – Now playing

It’s not just about throwing numbers at a digital to analogue converter.

To build a full system you need a media server to hold the files, a streamer to deliver the right files to a sound interface, a controller so you can tell it what to do and curation software to build the music library in the first place. It’s also a jolly good idea to back it all up from time to time.

Media Server

My media server is a dedicated Network attached storage (NAS) from Synology.  The Synology is essentially a highly customised Linux server which is optimised for managing discs.

NAS Audio Station
NAS Audio Station

It is capable of acting as a  DLNA server, which indeed it does, using the application Audio Station. Other devices in the house take full advantage of the DLNA capabilities this offers.

NAS storage analysis
NAS storage analysis

For the purpose of this project I have also configured the Synology to publish the folder containing my music as a network share using the File Station application. The share is configured so that it can only be accessed with a username and password and a dedicated account is configured for use by this project.  The media Streamer is configured to mount the music folders using that account. It does not use the Audio Station software.

I use my NAS for all sorts of things, including hosting this website. You can see from the Pi Chart above that audio files take up almost half of the used space.

Media Streamer

This is the part of the system which is responsible for the actual playing of the music. This software will run on a raspberry Pi connected directly to a sound card and by a wired connection to the network for quick access to the Media server.

I considered several options for pi based media servers, settling on  the MusicBox distribution. this is based on Mopidy, an open source music server. This has the capability to be upgraded and customised in many ways should I need to, but for now it has a couple of killer features that I need.

Direct network access.

To maximise performance MusicBox  is configured to access music from network attached storage instead of using the rather slow and cumbersome DLNA protocols. The fact that this storage happens to be hosted on the Synology is not important.

Scan Music

MusicBox scans the network music library when you tell it to and remembers what it finds.  This can take a while to do, but you only do it occasionally.  The payback is very fast song lookup and searching. This is possible because it happens within the pi with minimal network or disc access

Web Interface

While you can use various controller applications from your phone or tablet, I don’t want to do that. Slow and cumbersome.

Music box home

MusicBox comes pre-configured with several different web interfaces. because these tun on the Pi itself you don’t have the overhead of lots of DLNA communication and it can take full advantage of the library index created when you scan your music. I like and use the default web interface. I later changed the streamer software from MusicBox to Volumio (see here) but the principals remain much the same.

Controller

Various options are available to control the streamer. I just run the web interface direct on my windows laptop, phone or tablet. The HiFi is in an office and the laptop is nearly always to hand and switched on. A shortcut quickly launches the web interface.

Curation

Before any music can be played it needs to find it’s way onto the NAS drive. Most of my music originally comes from my extensive CD collection, with some digital downloads. Each track needs to be ripped to mp3 format, have additional information added and be saved into an appropriate folder structures on the NAS.

Ripping

This is the act of converting your CD’s into digital file formats. Various software can do this and many recommend EAC (exact Audio Copy) for best fidelity.

For pragmatic reasons I use Apple iTunes. The reason for this is historical. I have used an iPod (several) for years and this is the only way to get music onto these. I learned early on that apples proprietary music format, AAC, doesn’t work on other music players. You can change the iTunes settings so that it converts your CD’s to mp3 format. Mp3 can be used by pretty much any digital music player, which is handy since I use a variety of portable players including Sansa Clip, Q-BE and Victure as well as my iPod and Android phone. I also have appliances that can play music from an SD card. Digital speakers, mini hifi, car stereo’s and suchlike.

iTunes CD import settings
iTunes CD import settings

The other setting which is worth setting is to crank up the bit-rate to the highest possible. These days storage is cheap and networks are fast. there is absolutely no reason to use the awful sounding low bit-rate mp3.

Metadata

Mp3 files contain the music of course, but they can also contain other stuff called metadata. The obvious is the track name, artist, composer album and genre. You can also add stuff like album artwork and even lyrics, if you can get your hands on them.

I use iTunes to add or correct all of the above information.

Folders

Another useful trick which iTunes can be configured to do is to arrange your music files in folders, organised by artist and album.

Distribution and indexing.

So far we have collated a nice collection of music on the laptop. Sure, you could configure the streamer to read direct from the laptop, but that defeats the object of having a nice fast secure NAS which is always on. The files need to be on the NAS.

To copy the files across I use a great utility which was originally created by the photography club at Microsoft to help them manage thousands of digital photographs on various memory devices and drives. It’s called SyncToy and is a folder synchronisation tool.

SyncToy
SyncToy

SyncToy allows me to easily copy any new music files over to the NAS share. It works out what has changed and only copies the new or modified files, so it’s quick. It’s also a pretty good tool to use for other stuff, including your all important backups.

Once the files are updated on the NAS the final stage is to get the streamer to re scan for music. This re builds it’s internal music index so it knows about my latest acquisitions.

Backups.

A lot of effort has gone into creating my music library over many years. I don’t want to lose it. things are already better than most people have. I do after all copy my iTunes music library to my NAS device. So, It’s on at least 2 different hard drives. If my laptop dies or is stolen I have a copy. Actually it’s a bit better than that. The NAS is designed for high reliability. It actually uses two drives and puts the same stuff on both in a clever way which means it should notice when something goes wrong. If you are lucky you can usually replace a failed disk and the NAS will re build the contens from the remaining disc. This is the clever stuff you pay for with a NAS.

That still won’t help if your house burns down, you are burgled or you get a virus that wipes out everything your computer can see, including your NAS. Off site backups are essential for everything, not just your music library. How important are your family photo’s? This can be a very complex issue, indeed I used to make a living advising big companies how to do it using sophisticated equipment and software. In the home it needn’t be that complicated, but you MUST do it. I copy my stuff to a USB disc about once  month. The disc lives in a safe in a friends house some distance away, and there are several of them in case of mechanical failure. If some sort of disaster strikes that takes out my Laptop, NAS and those UAB discs; we are talking Armageddon and recovering my music library is the last of my worries!

Update: In 2021 I updated both the hardware and software of my streamer. read about it here.