Saturday, 19 April 2014

Whole House Audio - Step 2

Some time ago, I wrote a post on the foundations of a cheap DIY whole house audio solution. I haven't really progressed that idea much until this weekend when I got back to it.

I still have my squeezebox and squeezebox radios even though they're now discontinued. I also still have the Logitech Media Server driving them and Triode's plugin providing access to a premium Spotify account. Now with the unRAID system up and running, it was time to create a VM to act as MusicServer.

The hardware I have to hand is as follows;

2x Squeezebox Radios
1x Squeezebox II
3x T-Amps
1x M-Audio Delta 410

This is all legacy stuff I've had lying around for years and has been used in various aborted attempts at a whole house audio system. However, it's all in good shape and works and with funds tight, it's got to be used!

The objective is to set up a VM that runs Logitech Media Server which will serve music to all the hardware devices, will access the multichannel soundcard and facilitate software players that can address the 4x analog stereo outputs on the card as well as the SPDIF output for a total of 5 'zones'.

I opted for a windows VM to drive this as I'm most familiar with the operation of the M-Audio card and drivers on that platform, plus it's necessary to build the software player on Linux, not something I wanted to start getting into.

So, I popped the M-Audio Delta 410 into my MediaServer8 system and used the lspci utility in unRAID 6b4 to identify the PCI address (and any other cards that had changed - something to always check when adding, moving or removing PCI/PCIe cards). The card was on 08:06.0 so I added that to the syslinix.cfg (via unRAID web UI) and rebooted.

Next, I set up a windows 7 VM, passed through the audio card and installed the legacy drivers from m-audio's website. I also downloaded and installed the Logitech media server and got that up and running, scanning my music folder on my unRAID share and setting up the Spotify plugin.

At this point, I had my MusicServer up and running and the hardware squeezeboxen could access and play from either my local library or Spotify. Now, to set up the software players that would drive the zones.

There's a great utility called SqueezeSlave, (download from here), that runs as a headless software squeezebox. It's possible to run more than one instance at a time and in launching, it's possible to specify the audio device to be used.

The first step is to enumerate your sound devices. With squeezeslave downloaded to C:\squeezeslave\squeezeslave.exe, I opened up a command window in windows, CD'd to that directory and ran;

squeezeslave -L

That lists all the addressable audio outputs on the system;

I'm interested in Line 1/2 of the M-Audio Delta 410 card which I see is listed as directsound device 6. To launch an instance of SqueezeSlave that will address that output, I can use the following command;

squeezeslave -m 00:00:00:00:00:01 -o6

There are a couple of important points here;

The -m flag allows me to specify a MAC address for the virtual player. If  I'm going to run more than one, this needs to be different for each one. The -o flag allows me specify the output audio device, in this case, 6, as previously determined. If the media server was running an a different machine, I could further specify the as follows;

squeezeslave -m 00:00:00:00:00:01 -o6

One launched, the player shows up in the media server as 'squeezeslave'. I can pop in to the setting->player screen and rename this to whatever I wish (in this case 'Kitchen') as I'll be driving my kitchen speakers from this virtual squeezebox.

It's a good idea to launch squeezeslaves one at a time initially and assign them their human readabnle names, otherwise you'll end up with a bunch of players named 'squeezeslave' and it's tricky to figure out which is which. The media server will remember the player name in future connections based on the unique MAC address.

With the virtual player in place, I connected the 1/2 outputs from the M-Audio breakout cable to one of the t-amps and connected the kitchen speakers to the amp terminals (I'd pre-wired most rooms with speaker cable when renovating 10 years ago).

Now, using the media server web UI, I can play any tunes on my Kitchen speakers. I can also synchronise this virtual player to any other player to have the same music play in several locations.

I can also control the virtual player from any hardware device or wirelessly from an iPad using the free Squeezebox Controller app or the $5.99 SqueezePad.

Adding additional zones is just a case of staring a new squeezeslave instance. (with a unique MAC address and output assignment), wiring up and amp and speakers and hitting PLAY.

I write .bat files containing the zone start scripts so I don't need to remember the MAC addresses and assignments and launch this at VM startup so the whole thing is fairly automated.

I'm really happy with this set up and it's certainly a better price than a Sonos or similar system being based on hardware I have to hand. However, there a few minor niggles;

Firstly, streaming from Spotify is not supported on the virtual squeezeplay devices so that service is restricted to hardware devices only.

Second, synchronization is not perfect, with sometimes a tiny delay between zones which can manifest as a slight echo if you're standing in a position where you can hear both.

Finally, Squeezebox is dead so when these devices expire, I can't replace them. It's such a pity Logitech couldn't manage to keep what's probably still one of the best and most flexible platforms going. I guess I'll be spending the coming10 years looking for my next solution.

Here's the final VM running Logitech Media Server control panel, M-Audio control panel and resource monitor. The VM with 2GB RAM assigned handles multiple devices and virtual players perfectly.

No comments: