Join the 85,000 open source advocates who receive our giveaway alerts and article roundups.
Build a home music server with Linux
How to set up a Linux-based music server at home
Get the newsletter
In this article, I am going to focus on the hardware, software, and configuration issues that we need to resolve to set up a Linux-based music server as part of the home music system. Specifically, I'll look at the Raspberry Pi, Cubox-i, and Fit-PC as options for hosting your digital home music system.
Some of the material in this article can equally be applied to my previous article on the Linux laptop as a high-quality music player.
Console stereos vs. separates
First, let's talk about what a home music system is. In my parents' day, the '50s and '60s, a home stereo was a nice piece of furniture that happened to have stuff inside to play music. This furniture usually included a record player, to play 33⅓ RPM long-playing (LP) records, 45 RPM singles, and maybe even good old 78 RPM records. It also usually included an AM/FM tuner. Of course there was the amplifier, which took the signals from the tuner and the record player and amplified it to the point where the built-in speakers could play it. These so-called "console stereos" mostly went out of fashion in the late '60s or early '70s if I remember correctly, being largely replaced by separates—that is, a separate turntable, receiver/amplifier, and speakers; as well as (sometimes) a tape-playing device of various formats.
Today separates still exist, largely in relation to home theaters and in homes where music matters and the owners have space for such equipment. I would venture to say that the concept of the console stereo has been reborn in the all-in-one stereo, whether in the form of the boom box or more sophisticated offerings from "music as lifestyle" companies. This is the kind of device that has a docking port for the smart phone (which contains all the music). I'm not going to talk about these because there are many more interesting options for enjoying music, even if the space is limited to the kitchen table or desktop.
Finding the right audio equipment
For people who already have a Linux laptop with their music on it—and especially for people who have a small listening room—a really nice option to get decent sound is a set of powered speakers. As the name implies, these are usually compact speakers that contain the amplifier circuitry necessary to convert the low-level signals coming out of the computer's built-in or external sound card into the necessary power to drive the speakers. Some of these speakers even contain a digital-analog converter, so they can be plugged into the USB port or other digital output (S/PDIF or TOSLINK for example) from a laptop or desktop computer. One manufacture whose products seem to me to offer very good quality for a reasonable price is audioengine; another is Emotiva; and there are many more. People who wish to use their analog output of their laptop or who have purchased a separate analog-digital converter don't need powered speakers with a built-in analog-digital converter.
Another possibility for those with home theatre systems that use HDMI and Linux laptops or desktops that support HDMI out, is to connect the computer to an empty HDMI port on the home theatre receiver; or, the digital output (S/PDIF or TOSLINK) of the computer (assuming it has one) and the digital input of the receiver (again, assuming it has a matching input).
Choosing a server
I'm going to focus on a specific configuration that works well for me—a separate Linux-based music player, connected to a separate digital-analog converter, which is in turn connected to the analog inputs of the home stereo.
Today, many companies sell small, fanless computers oriented to home media use. A substantial number of those come configured with a Linux media-oriented distribution like Kodi. This might be a good combo for people interested in watching video and listening to music, but I'm really interested in a standalone music player. What I see in that space that really intrigues me are computers like the Raspberry Pi configured with its own digital-analog converter such as the HiFiBerry+, the fit-PC Mintbox and Mintbox Mini, and the SolidRun Cubox-i family. There are lots of other alternatives for sale at various online vendors.
Each of these units has its pros and cons, so let's get those out of the way first.
The Raspberry Pi and HiFiBerry+ combo is quite inexpensive and provides a set of analog stereo outputs that plug right into the home stereo (for example, the "CD" or "aux" inputs). However, to get music files onto the Pi requires either a USB hard drive or a network connection (with files shared over the network), and the USB interface on the Pi has a reputation of being underpowered. Also, for users who prefer an external USB-based digital-analog converter on the Pi, rather than the HiFiBerry+ or similar, having both hard drive and DAC connected may be a bit of an overload, though I cannot say from personal experience. I should add that lots of people use this configuration, so by all means consider it!
The Cubox-i family provides an eSata port, which leaves the USB free for other things (like a DAC). It doesn't have a "built in digital-analog converter option". Its Ethernet is Gigabit, but tops out around 400MB. It is hard to get the built-in wireless working, and I have read some negative comments on the suitability of its TOSLINK output for high resolution files. However, I have two of these and once configured in such a way as to avoid those pitfalls, they work wonderfully well, especially considering their reasonable price.
The fit-PC gear is lovely; very high-quality hardware. Accordingly, it costs a bit more. And the full fit-PC is actually a "real computer" with an i5 processor, lots of memory expandability, lots of connectivity options, and so forth; so it could be configured as both a desktop computer and a music server. Not that the Mintbox Mini is shabby at all! One of the coolest things is that 5% of the purchase of a Mintbox goes to the good people at Linux Mint.
Choosing the right software
What about software? I began my "home music server odyssey" in earnest with my first Cubox-i4 running Voyage MuBox, a Debian-based distro oriented to small appliance-style computers in general and—with the MuBox flavor—the Cubox-i in particular. This is essentially a very stripped down server configuration with mpd installed. I used this configuration with the USB connection on my Schiit Bifrost digital-analog converter, in turn connected to our home stereo. Music files are kept on a 2TB LaCie eSata desktop storage drive. I have since moved from Voyage MuBox to Volumio, another Debian-based music-oriented distro, as it has a decent web interface built in PHP to manage the mpd stuff going on below. Said web interface makes it easier for family members to access the players without needing a client installed on their computers or phones; they just use their browsers.
I now have two of these in operation, though the second one uses a spare AudioQuest DragonFly digital-analog converter that provides a software-controlled analog volume control, and is connected to an old amplifier and speakers that were sitting around gathering dust.
The Cubox-i4 connected to the Bifrost is a tireless workhorse music player. I control it from my Android phone, either using MPDroid or the web interface provided by Volumio. I have had many hours of very enjoyable listening to music through this configuration. It plays PCM format digital music up to 192kHz/24bit resolution and down to Ogg Vorbis at 128kbps and "internet radio." I have never had it disconnect or make funny noises while decoding music. I acquired the Bifrost in its early days; today there are many reasonably-priced alternatives out there. My only advice with respect to experimenting is to make sure you can return it if it isn't compatible with your Linux setup.
The Cubox-i4 connected to the DragonFly is not quite so happy. In particular, the DragonFly is not completely compatible with the 3.14.14 kernel that ships with Volumio. This manifests itself in an occasional "tick" sound. I've been chasing this down for awhile without success, and cannot in good conscience recommend this configuration. What I need to do next is try a different digital-analog converter to see if that eliminates the problem.
Don't forget that lots of people are in the process of trading up; you can often find secondhand equipment like digital-audio converters at steep discounts; not just on the obvious online merchants, but on specialist sites like Audiogon.
Let's recap. The main "home stereo" has a music server connected to it. That music server is a small fanless computer running the Volumio Linux distribution, with its music files stored on a hard drive attached by eSata, connected to the home network via Ethernet and to the stereo itself via a digital-analog converter. All of our CDs worth ripping—in my opinion anyway as I am the person who ripped them—are converted to FLAC at full CD resolution and stored on the hard drive. I have also purchased a number of music downloads, generally at full CD resolution or higher when available; those are stored on the same hard drive. Of course, I have multiple copies of the music files on other hard drives.
Mpd is the actual music playing software I prefer for this application. I configure it to pass the music files through as-is via the Advanced Linux Sound Architecture (ALSA) to the digital-analog converter, in my case over a USB cable. When using Volumio, the mpd configuration files are managed by the PHP server application, so it's wise not to mess with those files directly (For example: /etc/mpd.conf). When the music is actually playing, the progress can be monitored on various files within /proc/asound. For example, when playing a CD-resolution file in /proc/asound/DragonFly/stream0, I see the following:
Interface = 1
Altset = 1
Packet Size = 336
Momentary freq = 44150 Hz (0x2c.2664)
Feedback Format = 10.14
Endpoint: 1 OUT (ASYNC)
Rates: 44100, 48000, 88200, 96000
I find this configuration of software and hardware to be a very satisfying way to enjoy my digital music. Probably the only thing I miss is being able to read the record jacket while listening. One day I'll look at other hardware options for the music player and maybe the digital-analog converter, but for now it's time to go and listen to some music!
To close with some further reading: two interesting online articles that I've stumbled on over the past few weeks that I feel compelled to share: The High-Res Audio Guide and this curious paper that talks about physical perceptions of high-frequency sound (both good and bad).