My Whole House Music System

My Whole House Music System

I’ve long been interested in the concept of whole house music systems. Basically, you can start a playlist, streaming radio station, whatever, and have it play throughout your home. The music is syncronized and you don’t have to blast one set of speakers just to hear it. Why would you want this? Imagine if you were throwing a party and had people hanging out in the living room and on your back deck, or your upstairs living space and downstairs recreation room. If you want to play music, but don’t want to run speaker cable all over the place so everyone can hear it, a whole house wireless audio system is the answer. You can even let your guests browse your collection and add music to the playlist. With some systems, they can even play songs from their phones that you don’t have. there are other scenarios for this. Playing music while you do chores without having to wer headphones being one that comes immediately to mind.

You might have heard of systems like Sonos, or the Bose SoundTouch Wi-Fi Music Systems, these are great systems, but didn’t quite do what I wanted for a couple of reasons:

  1. They’re kind of expensive. At a cost of several hundred dollars per room.
  2. At least in the living room, there’s already a sound system connected both to the media PC and the AppleTV. I didn’t really want a solution that would require either a new receiver or another random speaker hanging about. Sonos does have a Sonos receiver that connects to an existing amp, but it’s $350.
  3. I had the idea that this is something that could be combined with a home automation system and the whole house audio could be used for providing alerts from your security system, IP/landline phone, etc. You could even tie it in so when a certain scene is started in your automation system, the lights dim, romantic music starts playing, and the fire in the fireplace turns on ((depending on the extent of your automation system).

For people who want a system that’s set up and go, these are great systems. I’ve played with the sonos and think it’s absolutely wonderful. I figured though, that there was likely a way I could build a similar system with parts I already had, or could obtain pretty inexpensively. Plus, the extensibility and integration mentioned in #3 above.

Warning: the following is extensively geeky, and you might not want to read it if you don’t care about such things. 🙂

Last weke I was reading something and stumbled on Pi Music Box, “A spotify, SoundCloud, Google Music player for the Raspbery pi”. Interesting concept, and there’s a spare Pi sitting around the apartment. I started digging, and found out that it didn’t support multiroom configurations, at least not without a lot of hastle. However, in the process of reading, I found the Logitech Media Server (formerly Squeezebox). this is a server package that runs on a computer and can play your music to any number of “Squeezebox” devices around the home. It actually looks like Logitech has discontinued most of the hardware, but the community has developed software that emmulates the old hardware.

In particular, of interest to my project, Squeezelite, a headless (no monitor required) player. This software basically runs at a command prompt, says to the server, “Hey, I’m a Squeezebox. gimme some music!” I installed the LMS on the media PC in the living room, as well as a copy of Squeezelite. And, to test the multiroom concept, I also put a copy of Squeezelite on my laptop.

At this point you might be asking yourself, “Okay, you have a media player. Big deal. What’s the point and, by the way, how do you control this thing?” The beauty of this is you can choose your music from your phone using a controller like iPeng ($7.99 in the iOS app store), iPeng Party (for letting your friends help make music selections), through the web browser, or through desktop apps. Once the server and player software was installed, I fired up the browser, told it I wanted to syncronize players, selected my laptop and the computer in the living room. Then I added music to the playlist and hit Play. Bam! I had music playing from both systems, in sync, and controllable from multiple devices.

Now that I had the proof of concept working and was satisfied this was good software, and not some overhyped crapware, it was time to take the next step. I wanted to put a player in the bedroom that wasn’t and entire computer. As luck would have it, piCorePlayer is a super lightweight package that can be flashed onto an SD card and loaded on a Raspberry Pi. This gives you an operating system (Microcore Linux), Squeezelite, and either a web interface or ssh command line access to control the whole thing.

Of course, things had gone smoothly until this point, but as with most DIY projects that wasn’t going to last forever. About a year ago I bought a raspberry Pi. I think originally the plan was to let Karen use it to learn some coding. Time being time, that project never came to fruition and it’s just been sitting around. So, time to put it to use. i also had an old Wifi adapter and, if the Pi’s onboard sound wasn’t decent enough, a spare C-Media USB sound card. I downloaded piCorePlayer’s image file, scrounged up a spare SD card, and wrote the image to the card.

this is when Murphy decided he wanted to come out and play.

I connected everything to the Pi. Wifi dongle, ethernet cable (you have to first connect with ethernet then set up Wifi), inserted the SD card, and finally power. The plan was to boot the Pi, look at the router status page and find the IP address it was assigned, then go on with SSH or Web based configuration. When I applied power, nothing happened. I got a red LED on the Pi to light, but no IP address was assigned. It didn’t appear that the unit was booting.

I thought perhaps something had broken since the unit was just sitting around for a year. In a case, yes, but still. Plus, one of the little contact dealies on the end of the SD card fell off, so I thought maybe something was wrong with the card, or the reader. I figured it wouldn’t hurt to order a replacement unit, and a new card. I found a package on Amazon from Canakit that came with a model B+ Pi, a wifi dongle, 8GB Micro SD card, power supply, and case.

The package showed up Saturday, so I figured I’d take a couple hours and put it all together. Plus, Karen was excited to see it in action, so there was that positive motivation. 🙂

Once we’d figured out how to get the board in the case, it was time to connect the new parts and try again. Alas, once again nothing. I even hooked up to the projector to see if there was video, and if the Pi was just not getting an IP, but when power was supplied it just didn’t do anything. My first thought was, okay, let’s try a different image, see if that boots. I downloaded Raspbian, one of the default OSs for the Pi. That still wouldn’t boot.

After a moment of frustration, I thought through the process again. I realized that I had used Roadkill’s disc Imager instead of the recommended win32 disc Imager (because Roadkill’s actually worked with my screen reader). ok, I figured let’s try the recommended imager. Once I wrote the image to the card with Win32 disc Imager, and powered up the Pi, trumpets played a fanfare, the crowds went wiled, people threw money at me in joy … or possibly the Pi did what it was supposed to do.

A brief accessibility note. Win32 disc imager does not work with JAWS. I didn’t try with NVDA, but the GUI uses QT, a library not known for being accessible. I need to find a workaround for this.

Now that I had the Pi showing up on the wired network, I needed to get the wireless working so it could go in the bedroom where there isn’t a wired connection. I used both the web and SSH interfaces to try and get the Wifi working, and I could, until I rebooted the unit. somewhere along the line, things weren’t getting saved. The way this distribution works is that the configuration is loaded from the SD card at boot, then everything runs from RAM. This not only limits the nnumber of read/write operations to the card, but also makes it safe to simply unplug the unit if it has to be moved or you need another outlet. since read/writes to the card only happen if you’re actively configuring the software, the chances of corrupting the card are greatly reduced.

since the utilities provided in the web interface (and the command line tool) are there to make set up easier for people, and are basically just scripts that take the entered data and put it in the different configuration files, I was able to follow their behavior and figure out where the actual values were being stored. Somehow, the system wasn’t writing my network name or password to the file. My network name has a space in the SSID, and the password has non alphanumeric characters. I’m not sure if this is what caused the problem, but I finally got everything working by putting the values in the master configuration file, bypassing the scripts.
Once that was done, I connected the Pi’s analog audio to a Bose SoundLink mini karen has, and fired the player up. PiCorePlayer2 showed up quickly in the controller on my phone and the web interface. I added some songs to its playlist, syncronized with the living room player, and once again had audio in both rooms without having to blast the stereo and annoy the neighbors.

Unfortunately, with the pi’s built in audio, there was a noticeable hiss when there was either no music, or the music was quiet. The solution was to use the USB sound card. once I set Squeezelite to use that output, the hiss disappeared entirely.

All in all I’m happy with this setup. I can play music from the local collection, Spotify, SirisXM Internet radio, a variety of internet radio streams, and several other music services I just don’t have set up. It will be nice to expand once in a bigger place. Where one or two more players will be useful. there are a couple of drawbacks. in writing this, I realized you can’t play music from your phone that might not live on the server. There is also, what I consider, a bug in the iPeng controller. If you use the search function instead of browsing your library, you can’t append a song to the current playlist, it simply plays it. I’m going to get in touch with the developer, because this is kind of annoying behavior.

All in all this was a fun project and I’m happy with the results.

Comments are closed.