As regards the "beat.ny" code, makes perfect sense now, yes I agree that original code is a bit confusing.
Once I read your explanation and your code simplification, together with what is written in the page about return values:
Then further down....When the return value is a character or string, a dialog window will appear with the data displayed as text.
Bingo!! The penny dropped.If an appropriately formatted list is returned to Audacity, a label track will be created below the audio track(s).
The format is then "constructed" and "pushed" like: ((number "string") (number "string") ... )
I also really like your code for the tempo.
Was going to surprise you by adding BPM, but I arrived at it via another way.
If you look at the table of values I posted earlier:
These values are in the "time" variable, so if we take the delta of any two consecutive values, invert
and multiply by 60, we get the BPM.
Taking the first two values:
(sorry, looks a bit convoluted as doing equations on the forum does not format too nicely)
0.744150 - 0.300150 = 0.440
1/0.440 = 2.2727
2.2727 * 60 = 136 BPM
1/(t2-t1) * 60
Interesting project, just had my "din-dins" so going to carry on coding.