Monthly Archives: July 2012

Some python code for calculating BPM and delay times

Some time ago I wrote this little script (I called it beatcalculator).

Pretty straightforward command line utility, use the switch –help to get help.

Here is the script, exported from emacs with htmlize-buffer: beatcalculator.

Copy and paste this code into a file called beatcalculator, put that file in your $PATH and give it execution privileges with chmod +x.

Then you can use it on the command line as simple calculator, providing the bpm you want to examine, or you can ask to analyze a wave file. you have to specify the number of bars contained in the wav file and optionally the meter (defaults to 4/4)

Here’s an example of the output you get (with a file with 2 bars of music):


$ beatcalculator -f afroeira123.6.wav -B 2

Meter is 4/4
--------------------------------------------------------------------------- 

afroeira123.6.wav is 3883 milliseconds
Bpm of afroeira123.6.wav is 123.62

123.62 beats per minute (bpm):

Note                            Delay time                       LFO freq
---------------------------------------------------------------------------
Whole                          1941.433 ms                        0.52 Hz
Dotted Half                    1456.075 ms                        0.69 Hz
Half                            970.717 ms                        1.03 Hz
Dotted Quarter                  728.038 ms                        1.37 Hz
Quarter                         485.358 ms                        2.06 Hz
Dotted Eight                    364.019 ms                        2.75 Hz
Quarter Triplet                 323.579 ms                        3.09 Hz
Eight                           242.679 ms                        4.12 Hz
Dotted Sixteenth                182.009 ms                        5.49 Hz
Eight Triplet                    161.78 ms                        6.18 Hz
Sixteenth                        121.34 ms                        8.24 Hz
Dotted Thirty Second             91.005 ms                       10.99 Hz
Sixteenth Triplet                  80.9 ms                       12.36 Hz
Thirty Second                     60.67 ms                       16.48 Hz

Hope you enjoy it.
Send me comments and suggestions to improve it.

Tagged , , , ,

Ardour 2.8.13 released

Ardour 2.8.13 released

New maintenance version of the stable branch of ardour, our beloved linux DAW

Tagged , , , ,
%d bloggers like this: