This bog provides a tutorial for building a Raspberry Pi music box which can be controlled using a hand held device through a web interface. Ideal for a bedroom where there is no desire to have a monitor / keyboard /mouse combination. The cornerstone of the build is the Rune Audio distro which supports FLAC, Vorbis and mp3 amongst other formats. I will be using a Raspberry Pi 3 Model B+ along with an IQAudIO Pi-DAC+ daughter board.
There is fierce debate between the proponents of Rune Audio, MoOde Audio, and Volumio. I elected for Rune purely because there is a native Android app available, and my smartphone is a Samsung.
|Raspberry Pi||3BPLUS-R 1.4 GHz 1 GB RAM 64-Bit||£34.56|
|SD Card||LXSINO 32GB Micro SD Class 10||£7.99|
|Power||Official 5V 2.5A Power Adapter for the Raspberry Pi 3||£7.99|
|Speakers||Creative Gigaworks T40 Series II||£79.99|
Of course I can't guarantee you'll get the same deals I got, but the pricing should at least be indicative. I already had the speakers I bought for a different project a few years ago that never saw the light of day, so that reduced my outlay to around £105 for this project.
Fitting the DAC to the Raspberry Pi is quite easy although there are instructions on the IQaudIO site. The DAC comes with some spacers and screws which align with the Pi's own. Since this is a quick sound test and I will be building the components into a proper case at some point, I only tightened the screws finger tight.
Once this has been completed, it's time to test it works fine. IQaudIO provide downloadable bootable images that can be written to an SD disk and will automatically play mp3 files. The best file on their downloads page is IQ_0_quicktestDigi*.zip.
Unfortunately the zip file was corrupted when I tried this. I reported this to their webmaster.
I couldn't find any build instructions for the case, but it is fairly straightforward. The first point to note is there are some standoffs which should be screwed into the four Raspberry Pi screw holes on the corners of the PCB. The case comprises six perspex sides, and they are slotted to ensure there is only one way it can all fit together - so the second point is it is crucial to dry run this first before it is screwed together to ensure there is no attempt to situate any of the panels the wrong way around.
The panels fit together very snuggly without any slack and comes with some small plastic feet to prevent it rubbing and sliding on the chosen surface.
Time to download our chosen repo. This is a small inconvenience because Rune Audio do not have an official Raspberry Pi 3B+ image. However there is a workaround - a community member has created a rar file download that can be fetched from the Rune Audio forums.
$ brew install unrar ==> Pouring unrar-5.7.1.mojave.bottle.tar.gz /usr/local/Cellar/unrar/5.7.1: 7 files, 520.7KB
$ unrar e RuneAudio_0.4_20180629_SC_Pi3B_Plus_v3_tml3nr.rar UNRAR 5.70 beta 1 freeware Copyright (c) 1993-2019 Alexander Roshal Extracting from RuneAudio_0.4_20180629_SC_Pi3B_Plus_v3_tml3nr.rar Extracting RuneAudio_0.4_20180629_SC_Pi3B+_v3_tml3nr.img OK All OK
To write the image to the SD card I use Etcher. This is a simple utility app although the command line can be used too with dd - not recommended for those with low experience. Once Etcher has completed it will provide a useful desktop notification. At that point the SD card is ready to be inserted into the Raspberry Pi.
The Pi can be booted once a network cable has been attached. If all goes well, it should be possible to point a web browser at http://runeaudio.local (see screenshot above). We now have the genesis of a music box but it still needs configuring.
There are a number of config screens to work through to get the system functioning correctly. Some of the changes will be specific to my circumstances so your mileage may vary. The MPD (Music Player Daemon) configuration needed one change - the need to select the IQaudIO audio output interface.
This one in particular may not suit all my readers, but I want to use the Europe/London timezone.
It makes sense to use a static IP address on your home network - so we can use a proxy in order for all devices to find their way to Rune. More of this later, but for now navigate to Network and you should see a sight similar to the first screenshot above. Click on eth0 and you will see the second screenshot. I have populated this form to use 192.168.0.204. My router has already been configured to assign DHCP addresses between 192.168.0.2->199. Anything 200 and above is reserved for my static IP address home servers.
The final configuration activity is to make Rune Audio aware of where the audio files are stored, and in my case they are on an NFS drive on my NAS server. Go to the Sources page as per the first screenshot above and click on Add New Mount. The form to complete for NFS mounts just wouldn't play ball at all, so in desperation I tried SMB/CIFS(OS X Share) and that worked - see the second screenshot. I called my source flac since this share contains all my high fidelity rips. I then repeated the process by creating a mount for mp3 for my low definition audio. The third screenshot shows the two mounts listed, and I have instigated a rebuild of the library, and this is shown by the updating spinner bottom left.
As soon as the library has been underway for a short period of time and has added a few artists / albums, playback can be tested. I picked an album at random for my end to end test, and it played seamlessly.
The native app scans the local network and automatically shows all the connected RuneAudio players, allowing you to control them from the same place. It also displays the RuneUI in a true full screen, with no browsers bars and weird scroll behaviours.The app uses the avahi protocol to scan the local network. It detects the connected RuneAudio players which expose the avahi service and lists them, showing also their IP and MAC addresses.
The resulting UI is actually the same as a web browser but I found it immensely frustrating. My habit is to tap the built-in Samsung back key to navigate and that immediately drops me out of the app. Restarting the app requires the initial network discovery to be run again, and mine steadfastly refused to connect initially, but then suddenly appeared to figure out my network and was rock steady afterwards.
Rune Audio uses the Avahi protocol which theoretically means when added to a local network, pointing a browser to http://runeaudio.local should 'just work'. Whilst setting up Rune Audio I noticed this capability was very hit and miss. There are ways of getting a rock solid configuration - for a desktop the simple solution would be to add runeadio.local to the /etc/hosts file.
$ sudo service squid3 restart