about summary refs log tree commit diff
path: root/website/sandbox/learnpianochords/src/Misc.elm
diff options
context:
space:
mode:
Diffstat (limited to 'website/sandbox/learnpianochords/src/Misc.elm')
-rw-r--r--website/sandbox/learnpianochords/src/Misc.elm12
1 files changed, 12 insertions, 0 deletions
diff --git a/website/sandbox/learnpianochords/src/Misc.elm b/website/sandbox/learnpianochords/src/Misc.elm
index 52f957ad528f..288d7a825f4b 100644
--- a/website/sandbox/learnpianochords/src/Misc.elm
+++ b/website/sandbox/learnpianochords/src/Misc.elm
@@ -45,3 +45,15 @@ find pred xs =
 
         x :: _ ->
             Just x
+
+
+{-| Return the number of milliseconds that elapse during an interval in a
+`target` bpm.
+-}
+bpmToMilliseconds : Int -> Int
+bpmToMilliseconds target =
+    let
+        msPerMinute =
+            1000 * 60
+    in
+    round (toFloat msPerMinute / toFloat target)