Me being a music junkie is not news to anyone reading this blog regularly. Until very recently, however, my home sound left much to be desired. You'd think this would be a priority for someone like me, but the reality is that
- I don't spend that much time at home, hence the investment was not at the top of the list
- and if I'm gonna build something, it's bound to be more than just a pair of cheap speakers attached to a noisy motherboard
This is the story of how I built some seriously overengineered sound that I (so far) love. Drake is never gonna sound the same.
tell me what you want
Just to avoid confusion, here's what I mean with "if I'm gonna build something…"
- speakers for all rooms. Maybe not the bathroom, the logistics of water and paper speaker cones are a bit tough, but at least the living room, bedroom, and kitchen.
- all capable of being in either sync or bridge mode
- the whole system capable of playing music from some legal source with a big enough library — brand loyalty means nothing to me, so I don't really care if it's Stopify, Play, or something else. I also don't mind the source of the audio being an external device, e.g., AirPlaying from my computer and the speaker system just handling the zone awareness, volume, and syncing.
- preferrably individual speakers are accessible via independent devices, e.g., if a friend comes over and wants to put on some music in my kitchen, they can just AirPlay or Bluetooth straight to the speaker without being on my WiFi
- the living room ones are also usable by my desktop for gaming, films, and whatever else
waaaait a second…
Now with all that listed, some of you might pointing towards Sonos, and you'd even be forgiven. They have great UX, and for what they are, they're great. They're also massively overpriced, closed source, and just too flat for my liking. Dubstep just doesn't sound right if your neighbours' silverware isn't bouncing to the tune of it. The Sonos alternative then is buying my own speakers and using a bunch of Sonos Connects, but that gets expensive, and still remains closed source and unhackable.
speak to me, baby
So I'm stuck building my own stuff. To build a sound system for your home, you need a number of things, but it all obviously ends with the speakers. If you're into massively overpriced and completely unbalanced speakers that smudge everything out with absurd bass levels, you can probably go for something by Beats. If you understand more than "this costs a suitcase of money, it must be great", and given the average size of a London room is not much bigger than the double bed in it, you probably want to go for near field studio monitors. If you're lucky enough and the rooms in your flat are more than 2 by 2 metres, go to an audio store and ask someone who knows. You want a flat frequency response that you can then adjust to match your room if you need to. Starting out with linear speakers means you have a blank canvas to work with, and it's relatively easy to tweak some stuff and make them sound great in that particular room.
In my case (and really most cases), those end up being KRK Rokits. They're relatively cheap, good, and available from almost every music retailer. Just decide on the size, but I'd venture a guess that you don't need to go above the 5's.
With the speakers done, we're now shopping for something to provide the sound signal. Active speakers make your life easier here, in that you don't need a separate amp as well. In my case, I want the whole thing to be hackable and adjustable to whatever filthy ideas my perverted brain can come up with, so a Raspberry Pi was a pretty obvious port of call. It's got WiFi and Bluetooth out of the box, it runs Linux, and it's pretty beefy for its size. The default audio output is on the rubbish side for quality though, but lucky for you, there are plenty of manufacturers out there making DAC modules for Raspberry Pis. Meet HiFiBerry, they're nice and they're Swiss, and they provide a Raspbian image with all drivers preinstalled and preconfigured.
That leaves us with the architecture of the whole system. I want my living room ones to be stereo, given that's where I do most of my living, and I don't care to take up the space in my bedroom and kitchen with more than 1 speaker, so that would have to be mono. If you've been paying attention, you'll notice that HiFiBerry has a stereo RCA output. That means I need a mixer. That's where this all being powered by a Raspberry becomes nice. The hackable part. Just mix it down in ALSA. Basically, check the last post of this thread and adjust it a bit to use the HiFiBerry card instead of the default one.
That gets us 3 Pies with working speaker output.
That's short for Music Over IP. Kind of like VoIP, just better and more useful. This bit is simple in theory and turned out tricky in practice.
First you need to connect your Pies to WiFi. That's simple, you need to edit
/etc/network/interfaces, add in the SSID and PSK, restart
networking.service and you're all set. In theory. We'll get to the problems later.
Assuming you have your Pies networked, now you just need a way to broadcast music and have it be synced. There are many options, ones I looked at include
and potentially some other similar things. Of those, only Roon provides the features I want. Of those, only Roon is not free. The rest of them either don't support any online music providers, or don't do zone awareness. It has a 14 day trial and a $119 per year charge after that. I don't really mind paying for software if it works as advertised and solves my problem, so I signed up for the trial.
With that decision made, I turned an old laptop into a Roon server, stashed it on a bottom shelf and forgot about it. Installing everything and tying it together was simple, things discovered each other right away. Roon only supports Tidal for streaming, but I've been contemplating switching to it anyway, both for the FLAC audio and it being more ethical with its royalties. It all tied itself together in a beautiful lossless symphony, I had music!
… for about a couple of minutes, until I was starkly reminded of my WiFi situation. I live in a (probably Victorian) conversion, the layout is a big, long sausage, and the router is on one end of it. Between that and my kitchen, there are about 10 metres and at least two actual brick walls. I'd been aware of my need for a repeater ever since I moved in, but I'd accepted the fact that I had dodgy WiFi in the kitchen. That wouldn't fly if I was to have perfectly synced music playing across my flat though. Thankfully, Amazon Prime to the rescue. 2 hours later I had a second router, set it up as a repeater — I was prepared to have to flash it to DD-WRT, but turned out the stock firmware supports that out of the box, so it was all nice and simple. I had music, sweet, lossless music!
… for about an hour. Then it started to stutter and died again. Checking the signal strength on the kitchen Pi said it was at ~ -70 dBm again. That made no sense. Then I checked the access point BSSID, and sure enough, it had connected to the weaker signal coming from all the way across the flat somehow. This was easily fixed by just hardcoding the BSSID in
/etc/network/interfaces (the key is
wpa-bssid if you ever need to).
After that it was smooth sailing. The basic system was up and running, and working beautifully.
… except for when the WiFi gets congested, and then the signal to noise ratio on the Pi in the bedroom gets a bit too much, and you start getting syncing errors. At this point, the system works fine most of the time, and when it doesn't, it's only the synced playback that has problems. Playing to an individual room still works just fine. Given it's a rented flat, I might try routing data via power lines for a stable connection.
connecting random devices
Next up was making sure I can connect other devices to it. My initial idea was making the Pies act as Bluetooth speakers, but that turned out to be a complete nightmare in terms of configuration, udev events, hooks, switching ALSA sinks and sources and whatnot, and I just dropped the whole thing for now.
AirPlay turned out to be much easier to set up. You're looking for shairport. You're welcome. You do need to build it yourself, but it's trivial to set up and works right out of the box. I can then use Tuneblade from my Windows PC (with some delay and latency tuning) and native AirPlay from my Mac to stream things. The only thing missing is being able to play sound from my Android phone to the speakers, and I've no idea right now. I might bite the bullet and set up Bluetooth at some later point if I really care enough or throw a party.
The end. Well, not really. But of all my requirements, I only haven't met one, being able to stream from my phone. Everything else works very nicely. Roon has been amazing so far, and they have an API, so you can build extensions. Someone's obviously built an alarm clock. I might have a go at some stuff later. The only semi-unplanned expense here has been the $120 per year for Roon, and I don't really mind, it works perfectly.
What about you? Any experience hacking together your home audio? Or did you just buy a bunch of Sonos?
If you enjoyed the read, drop us a comment below or share the article, follow us on Twitter or subscribe to our #MetaBeers newsletter. Before you go, grab a PDF of the article, and let us know if it's time we worked together.