How to Network your Mac music system with the Raspberry Pi and HiFiBerry – Part 1
In my introductory article, Computer audio on the Mac – getting started, I introduced the audiophile new to computer music to ripping and organizing a music library using iTunes on the Mac. Taking the next step is fairly straightforward, and involves using a better music player. I list several in the above-linked article. It’s impossible to make a specific recommendation, as everyone will have different priorities. But all of the players listed have a free trial period, and offer features and sound quality beyond what you get with iTunes.
I’m now going to take a bit of a right turn, and look at the Mac-based music system in a different way – in terms of networked playback. Some time ago, Joe Quinn introduced us to networked music playback in Using Apple’s AirTunes (AirTunes is now called AirPlay). I’ve used AirPlay on and off to stream music to an Airport Express, but wondered about more flexible options. The recent availability of small inexpensive Linux computers, exemplified by the Raspberry Pi, suggested that there had to be a way to do something here that is fun yet inexpensive.
The push to finally do something about this came when I was contacted by HiFiBerry, who make a number of add-on audio boards for the Raspberry Pi. They offer a DAC, a digital output board, and a 20W Class D amplifier. Combine one of these boards with a Raspberry Pi and some free or almost-free software, and you can put together a neat little networked audio streamer for a bit over a hundred dollars, and with very good sonic results.
In this short series of articles, I’ll put together a little music streamer – which I’ll call the PiStreamer – and explain to the Mac-based audiophile how to get started using it. In this first article, I’ll list the parts and show how it’s put together. Part 2 will explain how to set up the network architecture, and Part 3 will cover some additional topics.
Note that some patience is needed to get things running well. Please follow my instructions carefully – and have some fun in the process!
- What you need
- Assembling the hardware
- Setting up the card
- Connecting and starting up
- Configuration and initial test
- Concluding remarks
What you need
Here’s the shopping list:
- A Raspberry Pi 2 Model B. This is the second generation version of the Raspberry Pi, introduced earlier this year (2015). You can get it from the suppliers linked at that page, or in Australia, from GPIO Australia. [Note: as of March 2016, the third-generation Raspberry Pi 3 is not a good choice at this time as there are still “teething” issues.]
- A HiFiBerry Digi+ with output transformer, which costs $40, and a matching case, which comes in black or seethrough.
- A micro SD card. This is what you install the operating system on, and which the Raspberry Pi uses as its memory. An 8 GB card is fine. It’s easiest to buy one that comes with an adapter for regular SD slots, so you can just plug it into your Mac to program it. I used a Sandisk card like this one from Amazon.
- A 5V power supply. The simple way to go here is to get one a recommended power supply from the same place you get your Raspberry Pi 2. (I’ll look at audiophile PSU tweakery in a later instalment.)
Assembling the hardware
Once you have your hardware bits in hand, you can put it together. It’s pretty simple. Here are the parts:
Now, these are electronics circuit boards, so it is possible to zap them with a static electricity discharge. You don’t need to go to extreme lengths, but don’t do this right after dragging your feet around on new carpet. Touch your hand to some metal appliance, like a fridge or hifi system, to make sure you are not “charged up” before opening the anti-static bags that the boards come in. Then screw the four nylon spacers into the Raspberry Pi board, push in the HiFiBerry Digi+ board, and tighten the nylon nuts (don’t use too much force).
The case just snaps around the two boards:
HiFiBerry have a nice video if the above is not clear enough.
And that’s it!! You have built your streamer. It has three types of digital output: SPDIF, TOSLINK (optical) and USB. Which one you will use just depends on your DAC and setup. Below, I’m going to assume that you use SPDIF to start with, as it’s the most likely to work well most often. (How well USB works does seem to depend on the DAC, for unknown reasons).
Setting up the card
Now you will need to write the software to your SD card. Unzip the volumio download (if your browser didn’t already do it). Plug the micro SD card into the SD adapter, and plug that into the SD card slot of your Mac. (If your Mac does not have an SD card slot, you will need to use an external USB card reader.) Start Apple Pi Baker, and follow the steps shown in this screenshot:
When the progress indicators show completion, go back to the Finder and eject the SD Card (it will be called “No Name” or something like that). Remove the SD Card from your Mac, take out the micro SD card, and insert it into the slot on the Raspberry Pi. The contacts of the card are on the board side, as shown here:
Connecting and starting up
Make connections to the PiStreamer as follows (and in this order):
Ethernet. Just plug one end of an Ethernet cable into the RPi, and the other end into a spare port on your Ethernet router.
Audio output. Connect your DAC to the HiFiBerry Digi+ using the RCA or optical connections. (We will look at USB in the next instalment.)
Power. Plug the micro-USB cable into the socket. The small red LED on the end of the board near the microSD slot will turn on, and will then start flashing. A small green LED will also start flashing shortly after.
Wait for a full minute after plugging in the power, then in the address bar of a web browser on your Mac or an iPad (*), type “http://volumio.local”. (You might like to make a bookmark for that page now, so you don’t need to keep typing the address.) You should get this screen:
Configuring and audio smoke test
All of the configuration options are accessed from the menu at the top right:
Go to the System menu and under I2S driver, select “Hifiberry Digi,” and then click Apply:
You will get a message saying that you need to reboot. Before you do that though, go back up the page and disable all the extra services (we will re-enable some of those later). Then click Apply:
Go to the main menu and select Turn Off, then choose Reboot:
Wait a full minute, then type “http://volumio.local” into the address bar of your browser again (or click on the bookmark you made).
Once you get back to the main screen, go to the Playback menu and under Audio Output select “sndrpihifiberry”. Under Volume control mixer, select “disabled.” Then click Save Changes.
You will get a message about the MPD daemon being restarted. Wait another full minute (at least) before proceeding. This time, if your DAC has a signal sync indicator, you should see it come on.
Now it’s time for the “smoke test”!
Turn the volume on your stereo down LOW. Copy a few music files onto a USB stick and plug it into the RPi2. You should see “Updating” in the lower left of the screen. When that changes to “Browse”, click on it. You should see a list that includes USB. Click there, and you’ll see a list of music files:
Success? (I sure hope so!) At this point, you have confidence that you can play music from the PiStreamer. If you like, you can load more music onto the USB stick, or even plug in a USB hard drive. However, the library navigation interface in volumio is not very sophisticated, and at any rate, the main focus of these articles is about networking your Mac music system. In Part 2, I will continue with actually making the PiStreamer into a networked player with a better user interface.
I’ll preempt the followup articles by noting that this little box has made me rethink a few things about my home audio setup. The astonishingly low cost, coupled with excellent performance, means that these little audio “end points” can be put anywhere in the house and selected from a tablet as the audio player. While I haven’t yet written about its capabilities, I think there’s no reason every Mac user shouldn’t just get one to play with.
HifiZine and the author gratefully acknowledge the support of the following companies and individuals:
- HifiBerry, for providing the Raspberry Pi add-on board (DIGI+) and case used in this article.