From 76723fd7017b77f3f0c7de532fb789cd23b47ed8 Mon Sep 17 00:00:00 2001 From: Wiwi Kuan Date: Thu, 30 Mar 2023 19:21:44 +0800 Subject: [PATCH] Toggle Flat Note Names --- globals.js | 2 ++ index.html | 2 +- piano-visualizer.js | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/globals.js b/globals.js index 7ff13a0..6ef1827 100644 --- a/globals.js +++ b/globals.js @@ -23,6 +23,8 @@ let cc67now = 0; let sessionStartTime = new Date(); let sessionTotalSeconds = 0; +let flatNames = false; + // note counter let notesThisFrame = 0; let totalNotesPlayed = 0; diff --git a/index.html b/index.html index 82ed4c7..3d16abc 100644 --- a/index.html +++ b/index.html @@ -33,7 +33,7 @@ TIME:使用時間 | NOTE COUNT:總彈奏音符數 | NPS:最近一秒鐘彈奏音符數(括號為歷史最大值) | LEGATO:圓滑指數(最近一秒鐘平均來說有幾個鍵被同時按住)
- CALORIES:消耗熱量(估計值,好玩就好)| KEYS:現在正在被按住或被踏板留住的音 | PEDALS:左右踏板深度顯示
+ CALORIES:消耗熱量(估計值,好玩就好)| PEDALS:左右踏板深度顯示
(密技:點鍵盤最左上角的角落,可以儲存截圖)

diff --git a/piano-visualizer.js b/piano-visualizer.js index 22c36df..d16b303 100644 --- a/piano-visualizer.js +++ b/piano-visualizer.js @@ -188,9 +188,9 @@ function getPressedKeys(returnString = true) { } let noteNames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']; // default if sharp - if ([0, 1, 3, 5, 8, 10].includes(pressedOrPedaled.indexOf(1) % 12)) { + if (flatNames) { // flat - // noteNames = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B']; + noteNames = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B']; } const pressedKeys = []; @@ -239,6 +239,10 @@ function mouseClicked() { if (mouseX > 347 && mouseX < 420) { totalIntensityScore = 0; // RESET CALORIES } + + if (mouseX > 441 && mouseX < 841) { + flatNames = !flatNames; // toggle flat + } } console.log(mouseX, mouseY); } \ No newline at end of file