Moonbase59 / loudgain

ReplayGain 2.0 loudness normalizer based on the EBU R128/ITU BS.1770 standard (-18 LUFS, FLAC, Ogg, MP2, MP3, MP4, M4A, AAC, ALAC, Opus, ASF, WMA, WAV, AIFF, WavPack, APE)
Other
182 stars 23 forks source link

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

Open breversa opened 3 years ago

breversa commented 3 years ago

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 commented 3 years ago

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:

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" .
breversa commented 3 years ago

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