BPM

2013 March 29
by Simba
Oil-wheel kick drum by Paul Graham Raven, on Flickr
Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic License  by  Paul Graham Raven 

The advances in DSP and processing power since I started ripping my cds to store all my music on a computer drive are enormous.

Sometimes having an estimate of the BPM of a tango song can be useful, e.g. when searching for “slow” milongas, sorting by BPM would be useful. But tapping each song individually to store in tags — no way it’s worth the effort. I remember doing some experiments years and years ago with automatic BPM calculation, and the results were useless.

Now, on the other hand, there are open source solutions available. The one I tried got good results, better than I could achieve manually, I think. I used Sonic Annotator with a vamp plugin from Queen Mary:

http://code.soundsoftware.ac.uk/projects/sonic-annotator/files

The command line I used was this:

 ./sonic-annotator -d vamp:qm-vamp-plugins:qm-tempotracker:tempo -w csv --csv-stdout ../test.wav

And I did a small script to calculate for my collection. I probably should have used different parameters for vals and milonga, but I haven’t had the time to try this out (it is already a long time since I did this, trying to cope with the blog post drafts queue).

TMP=$HOME/vamp/tmp.wav
flac -d "$1" -f -o "$TMP" 2>/dev/null
BPM=$(sonic-annotator -d vamp:qm-vamp-plugins:qm-tempotracker:tempo -w csv --csv-stdout "$TMP" 2>/dev/null |head -n 1 |cut -d"," -f3)
metaflac --remove-tag=BPM "$1"
metaflac --set-tag=BPM=$BPM "$1"
rm "$TMP"

In Sonic Visualiser I could have the software play along the detected beats to see if the timing was ok. Depending on your sense of humour, this could be a funny version of what seems to be my favourite test track: Al verla pasar + kick drum

Play
No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS