Hacking your Linux computer for a better listening experience
Hacking your Linux computer for a better listening experience
In this article, I am going to focus on the hardware, software, and configuration issues that we Linux laptop users must confront in order to really enjoy that wonderful digital music on our hard drives.
Let's say you have a laptop running a late-model Linux distribution (Fedora, Ubuntu, openSUSE, Arch Linux, Linux Mint, Debian, etc.). In all likelihood, the distribution you installed includes a default application for playing music.
For instance, if you're running the GNOME desktop under Fedora, you probably have Gnome Music installed; if you're running the Unity desktop on Ubuntu, you likely have Rhythmbox in place. Or you might have a favorite player you install on your system that provides you with a set of features you find comfortable or maybe even indispensable.
You probably have some music files organized in your Music folder in your home directory, perhaps by artist then album. You also probably have some headphones or earphones or desktop speakers you use to listen to your music, and to use those you likely plug them into the headphone jack on your laptop.
Assuming all of that is true—and that you aren't plagued by weird configuration issues or unsupported hardware in your laptop—you can enjoy to the music you have put on your computer. And since this isn't an article about troubleshooting hardware/software incompatibilities, nor about "the best Linux music player ever," what more is there to say?
Well, it turns out that if you take your listening seriously and spend your cash on high-quality music or carefully rip your CDs (or LPs!) to digital, then using the default Linux audio processing chain to play your music leaves something to be desired. This is because your typical modern Linux distribution offers a really complex and general purpose audio processing chain with the goal of taking care of all the various sound-related processing chores that can happen on a modern computer: recording and playing back sounds, sound alerts, mixing, DJing, internet telephony, watching videos (with the sound synchronized to the video), and so on.
By focusing on the single task of playing music—and by spending a little bit of money on hardware—we can set up a dedicated music playback environment that ensures the bits in the music file are the bits that get to the digital-to-analog conversion process and thence to your ears, maximizing your opportunity to hear what was originally recorded.
The first thing we need to talk about is Pulse Audio. Chances are, your Linux laptop has this installed and uses it to manage various aspects of the sound recording and playback process. When Pulse Audio first appeared lots of people had lots of problems with it, but these days it seems to work quite well and handles things like mixing the audio stream you've tuned in from your browser with audio alerts and any other important sound events. However, one thing Pulse Audio does that we don't want done is resampling your data to its preferred output resolution.
So, we will take advantage of the Advanced Linux Sound Architecture (ALSA) audio pipeline that most often sits below Pulse Audio. Specifically, we will do this by connecting a second sound card that we will use for music-only purposes. We will send our music directly to ALSA, bypassing Pulse Audio along the way and encouraging Pulse Audio to manage the internal sound card.
This approach—two sound cards, one dedicated to music, the other left to general-purpose audio chores—has some great advantages. First, it meets our goal of having a streamlined and "bit perfect" audio pipeline dedicated to playing music. Second, it means that other sounds still appear in your laptop speakers or on your headphone-out jack, rather than getting mixed into your music. Third, it lets us select hardware developed especially for high-quality music reproduction and that can be selected to complement the electrical characteristics of your headphones or earphones.
Choosing a setup
I'm going to dive right into a concrete example that will provide the basis for understanding all of this. My laptop is a 2013-vintage System76 Gazelle Pro. According to the du utility, I currently have 180Gb of data in the Music folder in my home directory. When I want to listen to this music, I use the Guayadeque music player and I plug a Schiit Fulla digital-to-analog converter and headphone amplifier into one of the USB ports on the laptop. When I am traveling, I use a pair of Shure SE215 in-ear monitors to listen. If I am home, I am more likely to use my trusty AKG K701 headphones. Time to explain some of these choices and mention some alternatives.
Why the Guayadeque music player? The main reason is that it can be configured to pass output directly to the ALSA hardware device interface, thereby bypassing things like software mixers and resampling code that has the potential to modify our music in ways that aren't necessary, given that we are dedicating audio hardware to its reproduction.
Besides that important reason, Guayadeque is, in my opinion, a very nice Linux music player. It's fast, it handles my medium-sized music library well, and it has lots of great features. But it's not everyone's cup of tea, and there are alternatives that, while providing a different set of features, also allow the user to send music directly to the ALSA hardware interface. One such is GmusicBrowser; another is QuodLibet. Another interesting choice is mpd; I'll talk about that one in a future article on home music setups.
Why the Schiit Fulla digital-to-analog converter? First of all, it plays well with Linux. I have some experience with other digital-to-analog converters and I can claim with certainty that such is not always the case. Second, the Fulla is not terribly expensive at $79 plus shipping. Third, once again my personal experience is that the good people at Schiit make nice, reasonably priced equipment and provide great after-sales service. Fourth, the Fulla handles the music playing chores I want it to manage: it plays music files at the various resolutions and bit rates that occur in my library (from 16-bit 44.1kHz CD-sourced files to 24-bit 96kHz downloads from my favorite vendors). Fifth, it drives both of my headphones well and sounds very good doing so.
Having said that, there are alternatives. A quick search at your favorite online merchant will turn up a wide range of USB-based digital-to-analog converters at various price levels and with various features. One that I own and like in principle, but that has caused me some difficulty depending on the Linux kernel in question, is the AudioQuest DragonFly. I like it because it has a software-controlled analog volume control and because it supports the same wide range of resolution and sample rate as the Fulla. However, it is more expensive and I have had problems with Linux connectivity in some cases. My son has a Fiio product (no longer in production) that plugs into the USB port on his System76 laptop, works fine with Linux, and gives him decent audio, including higher-than-CD quality. Another one that intrigues me is the Geek Out; again more expensive, and I'm not sure about Linux compatibility, but it also supports higher-than-96kHz sampling rates and DSD. Has anyone tried this with Linux?
Which reminds me—if you're trying something that is not known to be compatible with Linux, try to buy it somewhere that will let you make sure it works before you pay. You need 15-30 minutes with the device to make sure of its compatibility. Look in the log files to see if you see any strange errors when you plug the device in or when you start playback. Look in
/proc/asound to make sure that files are playing at the resolution and bit rate that you expect. And make sure the gain is correct for your headphones or earphones.
Headphones and earphones
With regard to headphones and earphones, I won't say a lot except that if at all possible, try before buying.
Comfort is important. Also, different people seem to have a different idea of what sounds good when it comes to headphones, which may be related to interactions with the physical structure of the ear. I find both my AKGs and my Shures are very comfortable and sound great. There is some really interesting information on headphones, earphones, amplifiers, and digital-to-analog converters at Inner Fidelity, including test results for those who aren't satisfied with the idea of critical listening. Of course, most headphones are compatible with all Linux distros.
In the end, I suppose lots of people wouldn't notice these differences or wouldn't care if they did. In my case, listening carefully is a key part of my enjoyment of recorded music, and it is facilitated by having good equipment properly configured for the job at hand. My laptop-based system gives me the chance to enjoy my music while I'm working away from home, or at home without bothering the rest of my family. If you love your music, give it a try!