diff --git a/src/App.vue b/src/App.vue index 8ccb92fa..8afbf031 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,6 +11,7 @@ import { NEWLINE_TEST, NUMBER_OF_NOTES, UNIX_NEWLINE, + WHITE_MODE_OFFSET, } from "@/constants"; import { ScaleWorkshopOneData } from "@/scale-workshop-one"; import type { Input, Output } from "webmidi"; @@ -388,9 +389,6 @@ function sendNoteOn(frequency: number, rawAttack: number) { return off; } -// Offset such that default base MIDI note doesn't move -const WHITE_MODE_OFFSET = 69 - 40; - function midiNoteOn(index: number, rawAttack: number) { let frequency = frequencies.value[index]; if (!midiVelocityOn.value) { diff --git a/src/components/MidiPiano.vue b/src/components/MidiPiano.vue new file mode 100644 index 00000000..6b77d3e5 --- /dev/null +++ b/src/components/MidiPiano.vue @@ -0,0 +1,183 @@ + + + + + + + diff --git a/src/constants.ts b/src/constants.ts index 9e1ce571..34051aa5 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -25,3 +25,6 @@ export const KORG = { // Browser interaction export const LEFT_MOUSE_BTN = 0; + +// Offset such that default base MIDI note doesn't move in "simple" white mode. +export const WHITE_MODE_OFFSET = 69 - 40; diff --git a/src/midi.ts b/src/midi.ts index d7ca1962..1af13379 100644 --- a/src/midi.ts +++ b/src/midi.ts @@ -217,7 +217,7 @@ export function computeWhiteIndices(baseMidiNote: number, colors: string[]) { info.whiteNumber === undefined ? info.sharpOf + 1 : info.whiteNumber; let colorIndex = 0; const result = []; - while (whiteIndex > 0 && index > -1024) { + while (whiteIndex >= 0 && index > -1024) { if (colors[mmod(colorIndex--, colors.length)] !== "black") { result[whiteIndex--] = index; } diff --git a/src/views/MidiView.vue b/src/views/MidiView.vue index 369b1614..40bd66bc 100644 --- a/src/views/MidiView.vue +++ b/src/views/MidiView.vue @@ -1,14 +1,17 @@ @@ -178,6 +219,14 @@ onMounted(async () => { +