For some time now, Archphile has been my go-to Linux distro for my home music servers. I'm very sad to say that it appears Archphile is no longer, or at least so its website suggests.
This state of affairs prompted me to think about a new music server distro. On the one hand, there are a lot of options—e.g., Kodi, OpenELEC, AudiophileLinux, Voyage MPD—or I could even try a server install of my favorite general purpose distro. But there's one extra detail to consider—the hardware. In my case, I have two CuBox-i4Pro computers bought specifically as home music servers. And while they aren't weird, specialized hardware, they aren't ubiquitous Raspberry Pi variants either. So I need to find a distro, ideally one suited for music playback, that will run on the CuBox. I tried Volumio again (which, prior to Archphile, was my go-to). I liked the new user interface and what I saw when I installed it, but unfortunately ran into a show-stopper bug.
In my quest, I learned a bit more about the CuBox. I already knew it used U-Boot, but in my research I started to see comments that made me realize the little black box had some slightly unusual aspects. The Gentoo Linux wiki entry was quite illuminating (as is often the case with that distro), explaining, for example, that mainline support arrived only in January 2017. I began to understand that this wasn't quite the same thing as looking for an up-to-date distro for a late-model desktop.
Eventually, I decided to try Armbian.
Getting Armbian for the CuBox-i4Pro
The Armbian download page presents a kind of "rogue's gallery" of ARM-based computers the distro runs on. CuBox is listed right at the end, and clicking on that brings up download options. I decided on the server option, and I noted that both were based on the mainline kernel.
The comment that appears there, "audio does not work on all devices," gave me a moment's pause, but there was only one way to find out for sure. (By the way, kudos to the Armbian folks for a clean, simple, informative download page.)
The preparation step suggests the use of Etcher, but I decided to use my system disk's utility instead. From its menu, I chose "Restore disk image" and selected the Armbian image from the restore sub-window:
Note that it is REALLY IMPORTANT to make sure the destination is the SD card and not the system drive!!!! Do NOT write the Armbian image to your system drive.
My disk utility gave me an SD card with one partition and a big pile of free space, but the fine Armbian Getting Started docs promised that the system would grow to take up the free space on first boot. Fortunately I had the presence of mind to pick a nice, fast SD card; I was able to achieve a sustained 75 MB/sec write to it, which boded well for nice, crisp system responses.
Installing the SD card and booting Armbian
Installing the SD card in the CuBox is pretty straightforward, although it does seem a bit odd that it's inserted upside down relative to the CuBox's orientation.
Since Armbian provides a working console, I plugged a USB keyboard and HDMI cable into the back of the Cubox. I also connected an Ethernet cable and the eSATA cable from my external hard drive, and I was ready to go.
And to my great relief, everything happened exactly as explained in the Armbian docs. Again, my hat's off to the maintainers. Well done!
Once I created my user id, I was immediately able to login over SSH. This screenshot shows what it looks like.
I continued following the instructions, updating the software, and setting a fixed IP address. Finally, I used ssh-copy-id for key-based authentication.
At this point I had a basic, working system. Now I needed to install the Music Player Daemon (MPD) and get the music playing...
Installing MPD and mounting the music drive
I used apt to install MPD. It turns out MPD brings in quite a few other packages—I don't understand why MPD needs the DejaVu core fonts, but anyway...
This all went in a straightforward fashion.
Next I set up the mount point and mounted the hard drive that contains my music files.
As luck would have it, my music files are owned by user MPD group audio, so I didn't have to change anything there. However, since I want this drive to be mounted at boot, I needed to change /etc/fstab so it contains a line (in this case, the one beginning /dev/sda1) instructing the system to mount that device:
Finally, I had to tell MPD the location of the music. There are two ways to do this: The MPD configuration can be changed to reflect the music's location, or the default location can be linked to the actual location of the music. For whatever reason, the second approach seems to be most common; this may be to allow several locations for music that is spread across a system. I decided to follow this approach.
Next, it was time to configure MPD by editing the file /etc/mpd.conf. The man page mpd.conf(5) is a great resource for learning about this configuration, as it includes decent descriptions of the configuration parameters and it's well-organized by topic. The ArchLinux wiki, as usual, provides an excellent and detailed description of this task, as does the MPD user documentation. There are many other guides out there as well.
Fortunately, I had a very straightforward use case. Going step-by-step by following the MPD user documentation, I maintained the default music directory location as:
and maintained MPD's default behavior of following symbolic links in the music directory:
(note that the # in front of the line above turns it into a comment, which means "don't change the behavior").
I don't currently have a use for changing the database plugins' or neighbor plugins' default configurations. My MPD install came preconfigured with a curl input plugin, and I left that alone. Similarly, I'm not going to configure any decoder plugins, so, per the user documentation, I skipped over the section about decoder plugins to the audio output.
With respect to audio output, my needs are very specific. I always use an external digital-to-analog converter (DAC) that connects via USB and plays pulse code modulation (PCM) music files back at their original bit rate and word depth. I use a first-generation Schiit Fulla, an inexpensive combo DAC/headphone amplifier that I bought a few years back. Moreover, my DAC is dedicated to music playback from MPD, so I don't want any software mixing, resampling, or any other output streams. This is what is commonly called "bit perfect playback." In the MPD user guide, there is a brief chapter on this setup.
Given these requirements, the Advanced Linux Sound Architecture (ALSA) output plugin perfectly suits my needs. If I select the correct output device, it passes my music through, unchanged, to the DAC. To determine the output device, I used the aplay command:
Since I don't want any conversions, I selected the device hw:CARD=Schiit,DEV=0. I also needed to know the device number for MPD, so I used aplay again:
The combination of the above two screens told me I could refer to the device as hw:1,0.
Then I had to adjust the default configuration of the audio output section:
I needed to set up the output device and turn off the mixer and replay-gain handler. I also wanted to change the name. Then my audio output section looked like this:
Moving along through the MPD user guide, I didn't want any filters, playlist plugins (for now anyway), to fix audio format settings (since I want my DAC to handle the originals), nor to mess with Other settings.
And that's it. It was handy to have the mpc client for MPD installed and use that command to update mpd's database:
At this point, mpc can be used to check that the database is loaded
That sounds about right—6,535 songs to play. It was time to try it out, first with mpc:
It sounds just great! Now to clean up the physical mess and connect it to the kitchen amplifier and speakers!
And the music...
Before I go, I need to make one music recommendation: Curao, by Quantic and Nidia Gongoro, available on Bandcamp in vinyl, CD, or as a FLAC download. Awesome Afro-Colombian music! I ordered the LP, which arrived in yellow vinyl with a green splatter embedded. It sounds fantastic, especially those earth-shaking drums at the end of side 2. And, of course, it's always great to buy stuff on artist-friendly, Linux-friendly Bandcamp.