Creating a Budget Audiophile Stereo with a Raspberry Pi

Can you tell the difference between 24bit audio and an MP3? Are the audiophiles complete fools for waisting their money on high end stereos when a standard bit of kit is just fine? Who cares any way? Can all this be solved with Linux and Raspberry Pi? Damn right it can!

The nerd within has been seeking a new obsession. Something to get thoroughly agoraphobic about. The origins of this new interest are a little murky but most likely have their roots in the “Obsessed with Linux” years of my life when I fussed over encoding my music in .ogg format and ranted to people about the perils of mp3. I thought it was terribly important.

Time moved on and I recently realised that my audio setup at home was pretty ramshackle. My cd player was broken, files where on different devices and people kept ranting on about quality. Some said it did not matter, mp3 was more than adequate. Others were stridently advocating the need for lossless formats, high quality studio masters and specialised DAC’s (Digital to Analogue Converters) if playing straight from your computer or phone. Who was right and what should be done?

This is not a new argument. It’s like which is better, Karate or Kung Fu? There is no real right answer. The Guardian ran a very good article on this subject. One tester said that for him the listening experience was best undertaken when he was out walking and as such perfect quality was impossible.

Perhaps I should have stopped here and saved some money.

Obviously spending thousands of pounds on new speakers, pre-amps, amps, things with valves and rare room temperature superconducting cabling is not the right approach to take here. I wanted to have a fun. I wanted an achievable way of experimenting with and learning about the quality of different audio formats and hardware with the aim of figuring out for myself which camp was right, the good quality mp3’s are fine vs the lossless audiophile brigade.

The approach was simple and involved assessing the chain or pipeline through which the audio would move from the file itself, to my ears:-

Gain access to examples of the highest quality (e.g. the 24bit flacs available in some music retailers).

Build or buy a basic set of hardware which is known to handle the audio data correctly and not degrade it in any way, getting it from the CPU to my ear drums thus allowing me to decide for myself if I am missing out on anything or not.

Buying a new stereo was not an option here. I already have a perfectly good one. I got the cd player repaired and it’s just fine. Furthermore, buying ones which claimed to be marketed to the audiophiles seems to involve adding many many zeros on to the price. I needed a different approach. With this in mind, I brought myself a Raspberry Pi. At £25.00 for the core of the system, I felt I was off to a good start. Add £4.75 for a power supply and WiFi Adapter for £7.37. Total so far £37.13.

The DAC

I knew that the Pi could handle all of the various audio files right from the command line. FLACS, Oggs, MP3's WAVS. The initial stage of this project required me to do some research into how I could bypass the Pi's not very good built in Digital to Analogue Converter.

According to Wikipedia again; "A DAC converts an abstract finite-precision number (usually a fixed-point binary number) into a physical quantity (e.g., a voltage or a pressure)." and "Most modern audio signals are stored in digital form (for example MP3s and CDs) and in order to be heard through speakers they must be converted into an analog signal. DACs are therefore found in CD players, digital music players, and PC sound cards.Specialist standalone DACs can also be found in high-end hi-fi systems."

So, I had to source a DAC. It had to be:-

Portable.

Good Quality.

Not to expensive.

Supported by the Pi.

Able to be powered by the Pi.

A stretch goal was being able to use it on my phone (A Samsung Galaxy S4).

What Hifi have a good review of some of the contenders which I investigated.

In the end I opted for a different product; The KunLun e18. A freind at work (in the audiophile camp) had the e17 and frequently sang its praises. The device met all my criteria. There were many nerdy charts and diagrams of the supposed outputs on the site which I freely admit to not understanding. However the key line I cared about was:-

"USB Sample Rate Support 32/44.1/48/96KHz @ 16/24Bit."

This means that it can play at the highest bit depth (think range of volumes, not loudest and quietest, but the range to which the changes in amplitude can be recorded and played back).

The e18 was A bargain at £118.00 ;-)

The device itself was promptly delivered, nicely packaged with a lot of cables (some funky straps to job it to your phone), little rubber mounts and a ton of other things. This product worked with my phone and everything else. 10/10.

Setting Up the PI

The next task was to configure the Pi itself. In short I wanted the following:-

A debian based Linux flavour.

Something I could operate remotely without having to physically connect to the Pi.

Ideally something needlessly odd, such as using SSH to control it. Just so I can say that I did and that my stereo is odder than your stereo.

My Linux skills are basic. I can do some things but I am not espcailly advanced. With this in mind, I visited the Raspberry Pi site and found the downloads section. I recomend following their instructions for Noobs if you are new to this. You download the image and write it to an SD card (the instructions for this worked just fine). When you boot, the installation systems invites you to select one of several version of Linux for the Pi. I chose the most common one, a Debian derivative called Raspbian. Noobs downloaded it and set everything up. It was easy and I was up and running on Linux!

After configuring the WiFi device, I needed to install the following packages using apt-get.

MPD - This music playing deamon. According to Wikipedia; It plays audio files, organizes playlists and maintains a music database. In order to interact with it, a separate client is needed.

For some further light reading. I am a late commer to the game of using a Pi for audio. I would recommend visiting Raspberry Fi. They offer a Linux version ready compiled to support all of necessary things you need for this type of project out of the box. In the end I chose to stick with the standard distro though. I could also move onto this later.

The setup this far was using the standard sound jack built into the Pi. In order to complete the link I needed to bypass this and send the digital audio out via the USB cable to be handled by the e18 DAC. I was dreading this part and suspected that it would fail to work. I was relatively surprised though and was able to find the right configuration options. The DAC now handled the audio and played it. Technically we were finished.

The Important Part: Making it Look Bling

The whole setup looked pretty rubbish though. The Pi was just sat out by itself and the tension from the cables caused the Pi to move all over the place. I looked into a lot of third party cases which were available. They seemed ok and would have done the job, but I wanted something a bit more interesting. I wanted crazy mad stereo in minature.

Whilst trying to clear out my grandparent's garage of the hoards of scientific equipment, the lathe, the masses of tools, dead spider, the living spider, I came upon one of many boxes stuffed with scap metal. In this case aluminium. The idea hit me. Lets mount the Pi on an oversised block of metal. That would look just awesome.

Finding a suitable lump of metal.

Much head scratching later (I have no experience with this kind of work) I had managed to drill four holes and tap three of them. (There were four holes on the other side too with a broken off tap sticking out of, but we won't speak any further about that).

I mounted the Pi and gazed at my creation. It was ok but frankly looked pretty scruffy. I wanted to smarten the block up and also maybe make a recess for the DAC. A quick foray to an enginneers located next door to the office named Oxford Precision Components revealed some very bemused but very helpful engineers. I was quoted £110.00 to mill a recess into the block for the DAC, polish everything, chamfer the edges and get the snapped off Tap out from the underside. For an extra £30.00 they coul anodise it as well. This was pushing the budget up somewhat but the momentum was to great stop now so I handed over the block, some grubby twenty pound notes and held my breath.

At the engineers!

The work was superb. The anodising will keep the shine on the block and the visual impact of the blcok is really stunning. Silly? Absolutely, but great fun.

Mounting the Pi

Back Home!

A trip to maplin got some rubber feet for the base of the block for £4.95 and some rubber washers for the Pi for about £3.95. Certainly this has added up somewhat but no complaints so far.

Can you Even Tell?

Having reached this point I should say that I do not really care to much about the original objectives. This is not supposed to sound flippant, but the purpose of all of this was to do a fun technical project from which I could gain the following:-

Technical Knowledge from people at work.

Get my first Raspberry Pi and do something practical with it.

Experiment with Audio.

So far there has been little actual listening. Was the audio quality any good?

I could start posting detailed assessments of the experiences I had with the 24bit studio master of Peter Gabriel's album, SO. I could have purchased the same album on a cd and brought the MP3 download. Following this I could then try encoding on iTunes and then as Ogg Vorbis and listen to Don't Give Up at least 700 times. To be honest though I have better things to do. I can say that the quality is really good and I like my new stereo. I like being able to play any file format (good luck with that on iTunes) on a very simple device. I can SSH (with Juice SSH ) into the Pi from my phone (there is an app called MPD Droid that is easier to use but would not be the same).

There is this site called mp3ornot that plays you audio files and quizzes you to see if you can tell the difference in their bit rate. I got most of them right but was not perfect though.

A colleague also waded into the fray and wrote a small program which quizzed the listener on bit depths. Playing various versions of the same file at different bit depths. As with the bit rate test, I got some of these correct, but was by no means perfect.

In conclusion. You can definitely use a Raspberry Pi as a stereo. It's not the simplest setup and you have to think "right, I will now go and play music." This was good for making a disciplined mindset. I suspect though that I will end up peering in the window of the stero store in the near future. Perhaps my setup was simply to cheap and I sat down infront of a stereo costing thousands of pounds I will realise the error of my ways. Personally I am thinking 320kps MP3's and good quality headphones are just fine.