Trying MPD (Music Player Daemon)

For awhile now I’ve had an Ampache instance for streaming audio data. I originally set one up some time ago, but ran into various roadblocks with configuring the codecs that made it frustrating to use (at least have my audio files are in Ogg Vorbis format). As is usual, if at first you don’t succeed, take a breath and go again. This time the codecs work great.

But, I have continued using Rhythmbox on my actual computer for listening to audio. And it’s great. I really like it. But it’s also got a bug (among other trackers that have it reported, here’s one: Launchpad: Bug #840854 in Rhythmbox: rhythmbox randomly crashes at the end of some tracks) that’s bugging me.

I figured it might be worthwhile to give another player a try. Several years back I switched to Rhythmbox from Amarok which is also a good player, but began growing sort of big for my tastes. This time I poked around and ended up reading about the Music Player Daemon (MPD).

I actually ended up reading about it in a roundabout fashion. I was looking for information about which players support the MPRIS D-Bus standard, as I use that to feed the audio metadata to Conky so I can see what audio file is playing (it looks like there is a Gnome Shell extension (Gnome Shell Mediaplayer Extension) that may suit those needs in the future?).

In that search I came across mpDris, which is a client that connects to MPD to provide data via D-Bus and MPRIS. It took me a few cycles to wrap my head around what was going on with MPD. mpDris is a nice thin metadata-only piece, which doesn’t care about actually controlling anything. MPD, for its part, takes a similar philosophy, providing only the backend.

For the frontend I initially went with the command-line client MPC, which stands for Music Player Client. That got me up and running.

The problem I found was that, in its default installation MPD runs as a service for the entire computer, using ALSA to output sound. This caused problems with Pulse Audio. Something on the lines of it expecting uninterrupted control of ALSA. My options were to have Pulse Audio run as a system-wide service (which is not recommended) or to run MPD from my user session. I went the latter route.

It works great. One caveat was that mpDris needed to wait for MPD to be started, as it dies when it cannot connect. It also took a little bit to rework the script I was using to consume MPRIS data for Conky, as I had earlier updated it to work with Rhythmbox 3 (which if I recall uses MPRIS 2.1), and mpDris only supports the original MPRIS 1.0 at present.

I went with Sonata as a graphical frontend. It works well. It’s a very light frontend, though it lacks some of the audio libary management features of some others.

I may yet return to Rhythmbox, but for now it’s been an informative experience trying out MPD. One thing I haven’t delved into yet is using Ampache as a client for MPD. That may allow for reducing the complexity of the configuration/data storage of Ampache. It seems like it may be possible to simply replace Ampache with MPD entirely for what I use it for.

You may have noticed the abundance of links in this post. Most every time I interact heavily with free software, I am amazed at the number of projects and the number of people that have contributed to allow me to use this software. Even with all of those links, many other components went unmentioned, as they were libraries or other parts glossed over.

As an aside, if you are reading this post around mid-to-late November 2011, you may notice the anti-censorship link over the logo. That’s a link to information regarding COPA SOPA, the latest attempt by a minority of our society in the USA to act in a malicious and ruinous fashion at the expense of the rest of us.

While it is prima facie unconstitutional, that’s no reason to let such dreck be peddled by the representatives of the people. Censorship is an intolerable price to pay to protect a non-intrinsic right that’s already been extended well beyond the point of diminishing returns. Copyright needs reform, but not in this draconian manner.