Skip to content

Instantly share code, notes, and snippets.

@damionjunk
Created December 12, 2011 16:31
Show Gist options
  • Save damionjunk/1468104 to your computer and use it in GitHub Desktop.
Save damionjunk/1468104 to your computer and use it in GitHub Desktop.
BPM of Current Metronome in Overtone
(defn cur-bpm
"Returns the BPM of the provided metronome 'm'.
The difference between two consecutive beats divided by 1000 to find the
number of seconds. 60 divided by this number to find the beats per minute."
[m] (Math/round (/ 60 (/ (- (m 2) (m 1)) 1000))))
(def metro (metronome 89))
(cur-bpm metro)
;;=> 89
(metro :bpm 808)
(cur-bpm metro)
;;=> 808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment