How I built and maintain Cantata, an open source music player

In this installment of conversations with developers who build and maintain open source music players, we hear from Craig Drummond of Canata.
137 readers like this.
Yellow and red record playing

Opensource.com

This is the third in a series of conversations with developers who build and maintain open source music players. Craig Drummond is the developer and maintainer of Cantata, an open source music player that acts as a frontend (client) to the Music Player Daemon (MPD) music server. I have two small headless computers at home configured as music servers—one connected to our stereo in our living room, one in my upstairs office. I first ran into Cantata while I was looking for a way to control these servers, and wow, it is one impressive piece of work.

I was interested in learning more about Cantata, so I was grateful when Craig agreed to do this interview (which has been lightly edited for length and clarity). Without further ado, let’s chat with Craig.

Chris Hermansen: Looking at the GitHub page for Cantata, and the Debian publishing history for Cantata, it appears you’ve been working on Cantata since before 2014. Is that about right? What made you decide to start doing this open-source music player project? Did it have something to do with your comment, "Cantata started off as a fork of the Qt MPD client (QtMPC)?"

The Cantata open-source music player.

Craig Drummond: I’ve been working on Cantata since 2011. I used to be a KDE and Amarok user (loved Amarok 1.x, not so much 2.x). In fact, I was a member of the KDE core development team for a while. Whilst I loved the UI of Amarok, I needed to be logged into KDE for the music to play, but I wanted to leave my music playing and control it remotely. I looked around and found MPD—a headless music player. Being a KDE user, I looked for a KDE/Qt GUI, and the best I found was QtMPC. This project had been abandoned for quite a while and had some odd UI quirks, which annoyed me. So, I took the QtMPC code base, fixed some of its UI quirks, and ported it to use KDE libraries as much as possible. Initially, I planned to send patches back to QtMPC, but I made way too many changes.

CH: Are you a software developer in your daytime job as well? Do you work in a Linux environment, or something else?

CD: Yeah, software is my day job, too. It’s a mixture of Linux, Windows, and Android development. Most of the time Windows is used, with Linux running in VMs. I’d much prefer to be using Linux, but that's not my decision.

CH: One of the things about Cantata that really stands out for me is the extreme attention to detail—for example, the carefully written and helpful bits of "micro help" on the settings pages. What are some of the things about Cantata that really matter to you?

Cantata's Collection Settings dialog.

CD: Not something I have really thought about. Cantata has grown organically over the years by adding features that I wanted (AudioCD, cover downloading, etc.) and by adding features that others have requested (ReplayGain, Last.fm scrobbling which I never used, Jamendo, Magnatune, etc). Cantata has so many options and no user guide, so I thought adding notes to the config pages would help explain some of the options, limitations, etc. One aspect I like about Cantata is the overall appearance; from the monochrome icons (Font Awesome is great for this) to the grouping of tracks in the queue by album, queue backdrop, etc. For me, it’s important that a UI looks nice—as stated, that was one of the reasons for forking QtMPC.

CH: If I’m not wrong, it looks like the latest versions of MPD support cover art sharing (see here for an example, search for "albumart"). Any plans to add this feature to Cantata? Or continue relying on the MPD configuration having a cover art server "nearby?"

CD: Cantata already supports fetching the cover art from MPD—this feature was implemented in November last year, via a patch from another user.

CH: I’ll have to update the version I’m running. Are you a musician? How do you use Cantata—headphones, separate DAC, or home stereo? Do you listen intently, or mostly for background? Do you work while you listen?

CD: I’m most certainly not a musician!. I have a guitar, and can just about play Stairway to Heaven—but that’s about the limit of my ability. My listening is mixed. At the moment as I type this, I’m listening to the Rock mix on Radio Paradise—mainly as background music. But, when I get hold of a new album, it’ll usually be the only thing I listen to for weeks. I do love to listen to music though and will put on music as often as I can.

All my listening these days is handled by Logitech Media Server. For this purpose, I have two airplay speakers, an old squeezebox radio, and a Bluetooth speaker (which I use via squeezelite on a pi zero-w to bridge BT/LMS). I never use headphones, it’s always through speakers. I had a TEAC reference 500 system, which I replaced with a Libratone Zipp (Airplay).

CH: Tell us a bit about the libraries Cantata uses. For instance, why did you decide on Qt?

CD: Well, being an ex-KDE user, Qt was the obvious choice. QtMPC was Qt-based, after all. The first few versions of Cantata were KDE-based, with Qt-only builds as an optional choice. Later (2.0, I think), I moved the code to Qt5 only and dropped Qt4 (and hence KDE) support. Even though I’m now using GNOME, I do love the Qt libraries. Qt makes cross-platform development relatively easy—and hence Cantata has Windows, macOS, and even Haiku ports. All of the other libraries are used mainly because they are the default ones for their features (e.g., libmtp). I use Taglib for tag reading/writing, mainly because it has a Qt-like interface. However, it can occasionally cause crashes, hence Cantata (like Clementine) starts a separate process to read and write tags.

CH: You mentioned earlier that you’re moving on from MPD as a server, to the Logitech media server. Can you tell us more about this decision?

CD: I was searching for a system to play music around the house, and one that my wife would use. (The Cantata windows port began to see if she would use that, but [she] never did.) I looked around for solutions. I had BubbleUPNP on my Android phone. I tried to use that option, with MiniDNLA talking to Chromecast audio, but soon got annoyed by a two- to three-second gap between tracks. After this attempt, I tried Plex, which could also play to Chromecast audio devices. But again, there was a 0.5-second gap between tracks (horrible for live albums), and it was slow to update the music database.

Finally, I stumbled upon LMS. This option, too, supports Chromecast audio devices, but it also supports Airplay, DLNA, and a headless squeezelite application. I’ve long since given up on Chromecast, but the Airplay support is fantastic. With LMS I can have my music playing through the whole house, move the music queue from one device to the next, etc. All via an open-source server (LMS) talking to open-source players (the Airplay "bridge," squeezelite, etc.)

And, best of all—my wife can now actually use the system. She uses iPeng on her iPhone to control the devices—having control points on Android, iOS, etc, makes things so much more user-friendly.

From my perspective, I love how LMS separates the server from the playback, whereas with MPD they are one and the same. Having one server handling the music library and play queues for multiple playback devices makes sense to me.

CH: Interesting comments about LMS. I remember being pretty interested in it myself back when I really wanted a Logitech Transporter. Clearly, I need to take another look. Do you have any sense of the relative sizes of the MPD and LMS communities? The overall level of activity in both communities?

CD: Not really sure to be honest. I’m much more active in the LMS community than I ever was in MPD. (MPD’s author never liked the fact that Cantata stores its own music listing cache). The LMS forum (forums.slimdevices.com) appears to be more active than the MPD one (forum.musicpd.org). The LMS users and developers are pretty friendly, and Michael Herger (a Logitech employee) is helpful and usually responds to queries quickly. But as stated, I never really interacted much with MPD, so I can’t really provide much info on that side.

As stated, LMS suits my needs better, but MPD may well be a better choice for others.

CH: Do you have any future plans for Cantata? Things you’d like to add? Other open-source projects you work on?

CD: No future plans for Cantata, it is very much in a bug-fix-only state. Sometime later this year, I’ll release v2.4.0, but that’ll probably be the last feature release for a long time. As stated, I no longer actively use it.

As to other open-source projects: I used to write the KDE font manager and KDE’s icon-only taskbar, I’ve contributed patches to various open-source projects (KMediaFactory, Audex, Kino, MPDroid). A couple of years ago I wrote a Qt5 open-home control point. This project never matured and seeing as I also abandoned BubbleUPNP/MiniDNLA, I have not used it for quite a while.

The main project I’m working on is a Google Material-themed "skin" for LMS. The default web UI for LMS, while functional, is not pretty and does not really work on mobile devices. So, for the past year, I have been writing an HTML5/Javascript interface for LMS. However, I’m no web developer, so it’s all new to me. The great thing about this project is that it’s installed on the LMS server, so I can have a nice UI for LMS without installing any software (only a browser is required). If I’m having a BBQ, I can let the guests change tracks, etc, just by getting them to point the browser on their phone (iOS, Android, whatever) to LMS. If you’re interested, search online for "lms material skin." The only screenshots on my GitHub page are from v0.0.1 (and the UI has changed a lot). I’ve just released v1.0 of this a couple of weeks ago, but I’m still making changes. "Release early, release often."

CH: Pretty cool, I think I’ll take a look. I guess this will replace the use of iPeng in your household eventually?

CD: It would be nice, but it'shard to get my wife on new things. She likes iPeng, and it works for her, which is fine with me—at least she is finally using our digital music collection.

CH: I very much enjoyed my conversation with Craig. While I’m very happy with Canata/MPD delivering my music at home, it sounds as though I need to take a look at Logitech Media Server.

Music selections

I’ve picked up a few new albums lately. One that stands out is a lovely CD (yep, neither a download nor vinyl—am I losing my touch?)—Voices: Chant from Avignon. I’m a big fan of most Gregorian chants I’ve encountered, and this is a lovely example. And at the other extreme, I’ve been looking for some more Kwanzaa Posse for many years since first running into them on a CD purchased in the early 2000s, and I found this: Kwanzaa Posse Featuring Massive Attack–African Vibrations.

And finally, I asked Craig for a recommendation. His reply was, "Music is such a personal thing-hard to make any recommendations. I’m very much enjoying Avantasia at the moment, and I’ve been a fan of Iron Maiden, Magnum, and Thunder for more years than I care to mention! Having stated that, I also like Barbie Girl by Aqua (I have both of their albums!) Not a fan of most chart music, nor rap (but love Walk this Way with RunDMC), and could never get into Jazz."

What to read next
Chris Hermansen portrait Temuco Chile
Seldom without a computer of some sort since graduating from the University of British Columbia in 1978, I have been a full-time Linux user since 2005, a full-time Solaris and SunOS user from 1986 through 2005, and UNIX System V user before that.

2 Comments

Great interview. I've learned something new. I too like Gregorian chant and thanks to you I'm going to be listening to Kwanzaa Posse.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.