SOLVED: Command line BPM (beats per minute) Analysis in Linux

Here’s a quick programming thing to help the many many many people looking for an easy way to analyze beats-per-minute (or BPM) on linux.

I’d been using an old version of MixMeister’s BPM analyzer (free old version still available if you search) under WINE, but it would sometimes choke on my large music collection.  And I’ve been playing with music files for a while; surely there was a better solution?

Well, sort of.  I found bpm-tools (in Debian’s package manager, homebrew, and quite possibly yours as well), which seemed like it’d do the job nicely. It even seems to be a bit more accurate than what I’d been using, especially in the metal genre.

Until I discovered that it also blanked out the "genre" and "album cover" tags.

Well, that just won’t do.

So I wrote a little bash wrapper script so that eyeD3 (which is also used for the simple_covers script) will do the checking for existent BPMs (and compare the results for you if they’re really different), optionally not overwrite them, and write the BPM tag properly to the file.

It starts at the directory it’s run from and gets all mp3s recursively.

It has three optional switches:

  • –skip-existing saves on processor power by skipping those with BPM data
  • –save-existing is an optional switch; default is to overwrite tags
  • –quiet tries to minimize output to the terminal (eyeD3 may still output some)

You can get the script (it’s part of the yolo-mpd repository on GitHub as well) at https://github.com/uriel1998/yolo-mpd#bpmhelpersh