May 272012

Over the past few months I have been tinkering with a wondrous piece of software called Music Player Daemon, or MPD. The concept of MPD is pretty simple, it is just a service that runs in the background on a Linux or Windows box and plays music in a playlist until it reaches the end of the playlist. Other programs connect to MPD to control playback and manage the playlist. These are some of the things I really like about MPD:

1. The player can be controlled remotely over the network using a number of 3rd party client applications designed specifically to work with MPD. MPD runs on my home server where I keep my music collection, and I can control it from anywhere on the home wifi or over the internet. I use a program called Sonata to control MPD from my Linux workstation, QMPDclient from my Windows boxes, MPDroid from my phone, and Relaxx Player from any web browser, or I can even login over SSH into the server and use a command line utility. These apps all seamlessly interface with MPD even while they are being used simultaneously.

2. MPD can be configured to send output to multiple different places simultaneously. I now have my server’s sound card connected to an amplifier that runs speakers in my office and the bedroom. Output can also be broadcast over a network stream, which I can use to play from another computer in another room or another zip code! From the client programs, you can turn any of these outputs on or off at will (for example, if I wanted to listen remotely without disturbing the cat at home). MPD will also send output to multiple sound devices simultaneously. I was able to plug an iSub that I found at RE-PC into the server and now have nice bass in the office, which was a challenge because the isub registers as a separate audio device than the sound card and needs to run in tandem with another sound card. See footnote below about how I worked this out*.

3. MPD keeps playing even if all of the client apps are shut down. As long as the server is on (and my server is always on) and there still tracks in the playlist, music will play uninterrupted. Before I go to bed, I can queue up a few ambient tracks and then shut down the workstation. If I decide that the volume is too loud, I can pull out my phone and adjust the volume.

4. MPD maintains a database of all of the audio files in my collection, allowing for quick browsing through the files through the client apps. But the best part is that this database includes information about the directory/folder structure, so that I can browse through my files that I have organized loosely in folders by genre. Most audio applications (such as itunes) only let you browse by tags; my tags are a mess so that is not practical for me.

5. Playing internet radio over wireless through MPD seems to be more reliable than connecting to the stream directly from a computer on wireless. I have the network stream set up to stream in ogg format, which is more efficient than mp3. MPD will read pretty much any audio format, but then it gets repackaged into ogg to send to the other computers at a consistent bitrate. This is also a more reliable way to play WAV and FLAC files from my collection over wireless.

I do have a few issues with MPD, mainly with related to the network streaming:

1. The stream shuts off as soon as MPD reaches the end of the playlist. If this happens then I have to manually reconnect the stream at the clients. I’m sure there are ways around this, but nothing I have found so far seems obvious or easy.
2. The network stream is not synched with the local output, so there is a lag of up to several seconds between these outputs; this sounds pretty strange when walking between rooms. Also, the individual computers tuned into the stream are not perfectly synched. This is not MPD’s fault, it is a more fundamental issue due to buffering. There seem to be some solutions using real-time streaming protocols, but I haven’t been able to get any of these to work. More tinkering is needed on this front.

* Footnote about the iSub setup
The iSub is an odd beast that I picked up at the computer junkyard/thrift store known as RE-PC (Actually, Amie spotted the iSub on the shelf and talked me into buying it). It’s a subwoofer designed to work with an iMac, but it sort-of works on a PC. The only connections is has is a power supply input and a USB cable. When you plug the USB cable into a PC, it registers as a separate audio device. Under a typical Windows setup this is pretty useless because you want the iSub to run in tandem with another set of main speakers, and Windows only lets you select one audio device at a time. Since I am now using MPD as the home music player, and the audio output to be handled by my server running Ubuntu Linux, then I can use PulseAudio to solve this issue and use my iSub! PulseAudio is the audio back-end that handles audio output in Ubuntu; it’s quite versatile but can be a chore to configure if you are not using a standard setup.

At first I went into the Ubuntu GUI, messed around with the PulseAudio settings, and somehow enabled an option for simultaneous output on all audio devices. I thought that would be the fix, but it turned out that the output was not quite simultaneous. The output of the two devices drifted by only milliseconds, but that was enough to make it sound like a bad DJ mix. The problem is that the two devices have different quartz timers governing the speed of playback, and nothing was syncing them up. After further research, I discovered the also-wondrous PulseAudio Module-Combine-Sink. This module somehow synchronizes the output on two or more devices at a regular interval; however it requires manually editing the PulseAudio configuration files which is no trivial task. Now the main speakers and the iSub play perfectly synched.

Jul 012011

Other than the Mexico trip, my blog has been pretty neglected over the past several months because I have been busy with some spring cleaning; both physical cleaning and virtual cleaning.

First, I totally cleaned out and re-arranged my studio out in the barn. This was a much needed exercise; the new arrangement is a much better space to work in. Amie helped out by offering to mop the floor, which got me motivated to pull everything out of it and rethink the whole setup.

With the studio physically clean, the computer in there became an elephant in the room. The WindowsXP system on it had been running since 2005 and had a large accumulation of cyper-clutter that was slowing it down. So, it was time to reformat and reinstall Windows XP on that machine. Yes, I am still using WindowsXP, I will avoid Vista like the plague and don’t yet see any compelling reason to switch to Win7.

I also attempted to upgrade Ubuntu on my desktop machine in my office, to version 11.04. However, it crashed during the upgrade and never fully recovered. So, I was forced to start anew with that system too. It takes some time to start out with a new OS and get it all set up and working just the way I like it, but in the end it is nice to have a clean slate and figure out new/better ways of configuring things during the process.

During my Ubuntu overhaul, I discovered the wonder of Virtual Machines. I downloaded VMware Player for Linux, and created a new WindowsXP “Guest” machine that runs on top of the Linux “Host.” Now I can run my TOPO map program on this computer from within the virtual machine, Amie can use Microsoft Office Programs that she is used to, and I can now even VPN into my work computer using the Windows-Only VPN client that King County uses. This virtual machine exists as a collection of files, and I can simply copy the files to create a backup or have a whole new system to work with. I used this strategy to create a sacrificial virtual machine to infest with Apple software, for the single purpose of updating the firmware on Amie’s iphone, while keeping my other machine pristine from Apple’s bloatware. The only drawback of this system is that the virtual machine runs kind of sluggish compared to a stand-alone machine.

And finally, I helped my dad upgrade his machine to Windows7 from Vista.

Anyway, this is all probably not hugely interesting to the general public, but I have found it to be useful to document such feats for myself for future reference.

Now summer is here and my new excuse for neglecting my blog is that I will be out hiking & stuff.

Jan 252011

Our new outdoor clawfoot tub is now operational! We had an old clawfoot tub sitting out in the barn for about a year, while we tried to find the time and means to hook it up. The tub was acquired via Craigslist, from someone in Rainier Valley not too far away from here, and just a few blocks from some burly friends of ours. We also had an on-demand water heater sitting around, which we had purchased about 3 years ago for the Central District house. It turned out that the on-demand water heater wouldn’t work there unless we replaced a large quantity of galvanized pipes, but it turned out to be perfect for the barn and our patio tub project.

The barn had an old 6-gallon electric water heater; it only ran a small pedestal sink in the barn office. I didn’t like this heater because we used the sink so infrequently and it seemed like a waste of energy, so it usually stayed shut off. The on-demand heater would not only have the capacity to fill the outdoor tub, but we could now have hot water at the pedestal sink without wasting energy when it wasn’t in use.

Chickens Inspecting new Pallet Deck

The inspection crew

Pallet Deck under constrction

The pallet deck under construction

Back in December, I built a small deck out of a pair of pallets, upon which the tub would go. With the deck finished, the tub and on-demand heater and clawfoot tub in hand, all the pieces were in place to finish the project. All we had to do was install the heater near the old one, and install new outdoor taps that the tub would connect to. There was already a gas line running nearby feeding the barn heater that the water heater could be connected to

My friend Julio offered to help me with this project, in exchange for some computer help. He has quite a bit of experience with plumbing and drywall projects, and owns lots of cool tools. We started out by removing the old electric water heater and came up with a plan for running the lines to the new outdoor taps. Then we went out to gather supplies. We probably spent about 2 hours at Lowes trying to piece together various combinations of brass fittings, copper pipes, black iron (for gas, of course), pex, valves, and push-connectors. Neither of us had much experience soldering copper pipes, so we tried to avoid that. We ended up using pex to run the line to the new taps, and push-connect Ts to connect the existing copper piping, the water water heater, and new pex lines all together. These push-connectors seemed almost too easy, they claimed that you could just push them onto copper, brass, or pex pipes, and this would create a watertight connection; we were somewhat dubious. Back at the house, we began mounting the heater onto the wall and working out the plumbing connections. We didn’t make a whole lot of progress because the day was almost over, and Amie had a yummy dinner waiting for us.

Water Heater Installed

On-demand water heater installed

On Sunday, we completed all of the plumbing and gas connections. There were a few leaks initially, including at the push-connectors. The push connections were fixed by pulling them off (yes, they are even removable!), smoothing out the existing copper pipe more, and then by pulling on them and wiggling them. The other leaks were remedied with addition of more plumbing tape. By the end of the weekend, we had everything connected except for the vent. It required 5″ diameter Type-B vent, which was not available anywhere in the Puget Sound region on a Sunday. So, I had to wait until a weekday to procure a vent kit.

The next weekend, we completed the vent installation, connected the tub with washing machine hoses, and Amie and I took our inaugural bath. It was wonderful, except for a few kinks that needed to be worked out, like plugging the overflow drain for additional tub capacity, and fixing a leaky gutter that dripped cold water onto our heads. The drain/greywater handling is also still a work in progress.

View from the Tub

The view.

Enjoying the new tub

The payoff.