How to set up a Linux-based music server at home

No readers like this yet.
music infinity

Opensource.com

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.

Raspberry Pi

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!

Cubox-i

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.

Fit-PC

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.

A great Linux-based music server. Photo by Chris Hermansen. CC BY-SA 4.0.

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:


Playback:
  Status: Running
    Interface = 1
    Altset = 1
    Packet Size = 336
    Momentary freq = 44150 Hz (0x2c.2664)
    Feedback Format = 10.14
   Interface 1
    Altset 1
    Format: S24_3LE
    Channels: 2
    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).

Chris Hermansen portrait Temuco Chile
Seldom without a computer of some sort since graduating from the University of British Columbia in 1978, I have been a full-time Linux user since 2005, a full-time Solaris and SunOS user from 1986 through 2005, and UNIX System V user before that.

31 Comments

Nice article

I personally use a raspberry pi v2 with a durio sound pro board attached to it and a wifi dongle all running from a single 12v ac adapter. I use MusicPi which I went to from Volumio. All my local music is on my NAS but I also have spotify, soundcloud, tunein pro, google music, amazon prime music etc etc all accessible on it also as well as the ability to airplay or google cast to it. Furthermore with UPNP I can access it from any device in my house so music is available in any room. It is very inexpensive and the durio sound pro is one of the best dacs out there.

Thanks for the comment, Marshcroft.

Good to hear you are getting good results from the RPi. I see you use Volumio, too. Since you run an RPi, have you thought about trying Rune? Regrettably their Cubox-i build has been "coming soon" for quite a long time now, so I haven't been able to give it a try myself.

In reply to by Marshcroft (not verified)

Awesome article! Thank you!

Madison, thanks very much for the compliment! I'm glad you enjoyed it.

Great article which I've shared with many music loving friends.

Great topic and great article.

In your search for a server did you come across a squeezebox server (formerly slimserver) ? In terms of functionality and stability, it is hard to beat, very active user community developing add-on modules, great forum support. HiFiBerry makes for a great player. There is even a new add-on to support Chrome Cast Audio.

Another interesting product that covers streaming from your home music server to mobile devices and remote computers is subsonic. It encodes on demand using a codec and bitrate of your choosing, very useful if your music is in flac or alac.

I use both of these projects for years now, highly recommended.

All Open Source.

George M., thanks for your kind comment.

I was a big fan of Squeeze Boxes back in the day. I REALLY wanted a transporter... but anyway that's another story. However, I haven't really got interested in the server software itself, being relatively satisfied with MPD and its universe.

But in any case, thank you very much for pointing it out here as it's certainly another option for people to consider, especially for the home music server.

In reply to by George M. (not verified)

Thanks for bringing this topic the forefront. Subsonic server is a nice solution that runs on various platforms. Just wish it supported DNAS for audio components.

DrewW, thank you for your comments!

I took a look at Subsonic's web site and the WIkipedia article. I guess what was not obvious to me until I read those is that Subsonic is:
1) a streaming server, ie it reads your music files and streams them to clients, which is a whole different kind of architecture that may be interesting to people for all sorts of reasons;
2) an open source core with closed-source "premium" add-ons - not that there's anything wrong with that per-se but just so that people reading this understand.

I recommend that anyone interested by the above read the web site and the Wikipedia article. Search for "subsonic music server" in your favourite search engine.

In reply to by DrewW (not verified)

Great article Chris. Makes me want to redo my custom DAC.

Thanks for the comment, BJ Maynard!

I know what you mean! Sometimes I just wanna BUILD SOMETHING. Lately I have been hankering to build something with TUBES. Good grief!

In reply to by bmaynard

i guess im just simple. i have a dell laptop with i7 processor and 8 gig mem that i use as my source for media entertainment. it is connected to my 32 inch flat screen via HDMI cable . for all my media pleasure, i either use online websites through my browser, for which i have tons of sites saved and bookmarked, or i can ssh into my desktop computer that houses a 1tb hard drive with movies and music to my heart's content. and what is comfort without a wireless keyboard and mouse from the recliner? the only thing missing is someone to get me a refill on my iced tea

Muzikjock, thank you for your comments.

One of the great things about Linux is that there are lots of different ways to a similar path.

For me your solution wouldn't work, because we long ago separated "the stereo" and "the TV", which we moved into the basement family room, and "the stereo" is much better at playing music than "the TV". But for people who have their TV and associated equipment in their main living area, your solution would be pretty practical.

I would still advocate trying a separate music-only digital-analog converter, just to get your music stream fully away from all that mixing of those system sounds...

In reply to by muzikjock

IMO, these systems are becoming obsolete. A Chromecast Audio for $35 gives quality at least as good, and installation is just plugging it in and connecting it to your wifi. I haven't bothered to buy one, because I have extra original Chromecasts already, and they work just as well. It's just a little more involved to convert to analog or SPDIF, requiring an adapter, but I have those already. My Cubox-i is gathering dust, as is another SoC computer I acquired. I've tried using them as DLNA servers, file servers, and other things, but it's just more trouble than it's worth. My router does an excellent job as a fileserver, accessible from anywhere, and it's easier to just stream music from Google, which has all my music on its servers, as well as almost everything ever recorded. Simple is better, and I don't need another server to maintain.

Stan, thanks for the comment.

I like the Chromecast Audio. It has many wonderful qualities, and I might even get one some day. But for my current purposes, which is primarily listening to the wonderful music I have on hand right now, it's mostly a kind of roundabout way to get the music in my files on my hard drive into my home stereo. For sure, though, I would have to think long and hard and do a lot of listening before I would spend any more on a streaming solution.

Thanks again for the comment! For sure it's a good alternative for people to consider.

In reply to by Stan (not verified)

I have benefited greatly from this article , Thank you Chris

Redadon, thank you for the VERY kind comment. I'm delighted you found some value in the article; makes it all worthwhile. Thanks!

In reply to by redadon

awesome Chris! Can't wait to give this a shot over the weekend :)

Johnny, thanks for the encouraging comment! I wish you luck and great results!

Great article which I've shared with many music loving friends

Ismail, thank you very much! I hope you and your friends are able to get as much enjoyment out of their Linux based music systems as I do out of mine.

Coool Chris, i've really benifited from this article! Thank You

Really nice. To think one could setup a full fledged studio someday using Linux and open source software only.

Bensoft, thank you very much for your kind comment! A studio is a bit beyond my abilities but for sure the whole Jack thing is oriented toward recording. Check it out!

In reply to by Bensoft

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.