EDIT 22 June 2020: You want to check out the rewrite of this program.
There are a lot of ways to autoqueue or create “smart” playlists; there’s problems with all of them. I’ve completed a program that solves quite a few of them.
I’ve written it with MPD (the Music Player Daemon) in mind; it works well with several of the other programs that I’ve put together (like volume normalization and bpm setting and getting cover art on your phone), but if you use RhythmBox, Audacious (or any players that allows input from the commandline) it’s easily hackable.
Which brings us to why I put it together. I used to work with GJay, but GJay highlights several of the problems I’ve run into:
* Opaque code (in a language I don’t know well)
* HUGE amounts of user input needed to judge the “color” of each song to get it to work well
* Data stored in XML, which tends to require special tools to parse
* Does not handle UTF-8 or UTF-16 filenames (for, say, a Japanese band) well.
MPD_sima is another tool I tried, which highlights the other problems I kept running into:
* Relies on external services (which don’t always give good suggestions)
* Is completely reliant on black-box algorithms (Pandora, Google Music, Spotify)
* Falls back on completely random selection from your music library
And so that’s where mpdq comes in.
* It’s written in bash, and aside from MPD, only requires MPC, Zenity, AWK, and ffmpeg (and if you’re on linux you probably have all of those in your repositories).
* It stores its configuration files in plaintext in $HOME/.config/mpdq
There’s two setup stages for it after you configure the setup file.
The first is associating genres with each other (and that’s where it uses Zenity). It goes through all the genres you have, asking you to match it with other ones. Perhaps New Age goes with Acoustic and Downtempo for you, or it only goes with New Age. Doesn’t matter. If you skip this step, mpdq will use the genre of the currently playing song.
The second setup stage you can’t really skip – you have to let it scan all your music files for BPM data and song genre. (MPD does not store BPM data in its database, so we have to store that separately). That can take a while, but can be updated easily.
Both of those take a bit of time, but not nearly as much as trying to tag each and every file in your music library with an arbitrary “color”.
When mpdq is running, it first looks at the currently playing song. If there are
matching genres already configured, it picks one of those genres
randomly. From that set, it narrows it to songs within the defined BPM
range. And then it checks to make sure it’s not been played within the
user defined length of time.
If the first match doesn’t work, it tries again with a slightly wider
range of BPM values. It repeats this up to ten times, and if it still
cannot find a match, it will try to find a song within the original BPM
range in any genre.
It’s as good as your music tagging and “matching” of genres is; if you cross-pollinate a little too much you can end up with some “drift”, but even then it’s a pretty natural and easy slide and not as jarring as going from “Nights in White Satin” to “Bodies”.
And if you use another music player and use this program as the framework to create an autoqueue for it, please let me know!