Moonbase59/loudgain

rgbpm : where do you get bpm-calc from ?

breversa opened this issue · 2 comments

rgbpm seems to be a lovely script ! Just where do you get bpm-calc from ? Maybe https://github.com/marionnewlevant/bpm-calc ? There's sadly no release nor package.

Sorry to say: Nowhere. Like loudgain, it was originally written for my own personal use, based on a 2006 Python script by Erich Schubert, which I heavily modified and which in turn uses Mutagen, Queen Mary University’s Sonic Annotator and some hand-coded vamp plugin.

I simply never bothered to remove the call to bpm-calc, because I didn’t like having to keep two sources. It also shows how one could put in and use some BPM calculation. (You could put a call to your BPM calculator there.)

BPM calculation is still quite an inexact science, and quite complex if trying to do it "right", so you might actually be better off using another available tool before loudgaining your files (that is because loudgain can repair incorrect tags sometimes written by BPM software).

Sorry again for not publishing my solution here, because I’m totally unsure if that would comply with the licenses of the software I used.

If you really want to go "the hard route", you’ll need:

  • Linux
  • Queen Mary University’s sonic-annotator and the qm-vamp-plugins (put these in ~/.vamp).
  • bpm-calc.n3 (which I’m happy to provide below; also goes into ~/.vamp).
  • A script (I used Python and Mutagen) to check your file and type, and if it’s already got BPM tags, then calls sonic-annotator and bpm-calc.n3, reads the CSV output and writes the tags into the file.

To give an example, here’s the commandline I construct for the Sonic Annotator (in Python):

command_line = 'sonic-annotator -t ~/.vamp/bpm-calc.n3 -n "%s" -w csv --csv-stdout --csv-separator "\t" 2>/dev/null' % file + ' | cut -f5'

An here is the contents of bpm-calc.n3 with the parameters I use:

@prefix xsd:      <http://www.w3.org/2001/XMLSchema#> .
@prefix vamp:     <http://purl.org/ontology/vamp/> .
@prefix :         <#> .

:transform a vamp:Transform ;
    vamp:plugin <http://vamp-plugins.org/rdf/plugins/qm-vamp-plugins#qm-tempotracker> ;
    vamp:step_size "512"^^xsd:int ; 
    vamp:block_size "1024"^^xsd:int ; 
    vamp:sample_rate "44100" ; # otherwise step & block size might not fit
    vamp:plugin_version """5""" ; 
    vamp:parameter_binding [
        vamp:parameter [ vamp:identifier "dftype" ] ;
        vamp:value "3"^^xsd:float ;
    ] ;
    vamp:parameter_binding [
        vamp:parameter [ vamp:identifier "method" ] ;
        vamp:value "1"^^xsd:float ;
    ] ;
    vamp:parameter_binding [
        vamp:parameter [ vamp:identifier "whiten" ] ;
        vamp:value "0"^^xsd:float ;
    ] ;
    vamp:output <http://vamp-plugins.org/rdf/plugins/qm-vamp-plugins#qm-tempotracker_output_tempo> ;
    vamp:summary_type "median" .

Thank you for your reply. I've never had any real use for a BPM scanner, but I though it'd be nice to have nonetheless. Maybe that'll benefit someone else. :)