summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2014-10-19 08:55:47 +0100
committerMatthew Hodgson <matthew@matrix.org>2014-10-19 08:55:47 +0100
commit6b996621847977055ef220f3a05ccb71b7d207f0 (patch)
tree1b9888885cf1e3d6add2bb0dde8ea93b2ccbaae3
parentFixed runtime errors (diff)
downloadsynapse-6b996621847977055ef220f3a05ccb71b7d207f0.tar.xz
fiddle log function
-rw-r--r--webclient/components/matrix/midi-event-handler.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/webclient/components/matrix/midi-event-handler.js b/webclient/components/matrix/midi-event-handler.js
index 2cc254362a..dcbca494e9 100644
--- a/webclient/components/matrix/midi-event-handler.js
+++ b/webclient/components/matrix/midi-event-handler.js
@@ -89,7 +89,11 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
         var fraction =  duration / this.beat;
         console.log(fraction);
 
-        return Math.floor(Math.log2(1 / fraction)) - 1;
+        // log2(4) = 2  # 4 beats == whole bar == w
+        // log2(2) = 1  # 2 beats == half = h
+        // log2(1) = 0
+
+        return Math.ceil(Math.log2(fraction));
     },
     
     renderChord: function(duration, rest) {
@@ -106,6 +110,7 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
             case 1:
                 musicFraction = "q";
                 break;
+/*          // quantise to quavers for now
             case 0:
                 musicFraction = "8";
                 break;
@@ -115,6 +120,7 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
             case -2:
                 musicFraction = "32";
                 break;
+*/
             default:
                 console.log("## Ignored note");
                 // Too short, ignore it