Created
December 12, 2011 16:31
-
-
Save damionjunk/1468104 to your computer and use it in GitHub Desktop.
BPM of Current Metronome in Overtone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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