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.