Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgbpm : where do you get bpm-calc from ? #38

Open
breversa opened this issue Nov 8, 2020 · 2 comments
Open

rgbpm : where do you get bpm-calc from ? #38

breversa opened this issue Nov 8, 2020 · 2 comments
Labels
usage Usage questions and examples wontfix This will not be worked on

Comments

@breversa
Copy link

breversa commented Nov 8, 2020

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.

@Moonbase59
Copy link
Owner

Moonbase59 commented Dec 28, 2020

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" .

@Moonbase59 Moonbase59 added usage Usage questions and examples wontfix This will not be worked on labels Dec 28, 2020
@breversa
Copy link
Author

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage Usage questions and examples wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants