From 3329166262119b930133adb17976a2459bf15bea Mon Sep 17 00:00:00 2001 From: Patricio Rivera Alfaro Date: Sun, 12 Jul 2026 23:24:13 -0400 Subject: [PATCH] fix: play the selected cell's expected pitch from the piano keyboard and note picker PianoKeyboard and NotePicker each owned useAudio and called playNote directly with a bare pitch class, which always defaults to octave 4. Extracted the octave-computation math from MatrixGrid's noteForColumnPlayback into a shared computePlaybackNote helper, had both input components emit note-click instead of playing sound themselves, and had PlayingView compute the correct octave-qualified note for the active cell before playing it. Fixes #122 --- src/components/MatrixGrid.vue | 16 +-- src/components/NotePicker.vue | 13 +- src/components/PianoKeyboard.vue | 9 +- src/components/PlayingView.vue | 22 ++- src/components/__tests__/NotePicker.spec.ts | 32 +++++ .../__tests__/PianoKeyboard.spec.ts | 26 ++++ src/components/__tests__/PlayingView.spec.ts | 52 +++++++ src/music/__tests__/matrix.spec.ts | 134 +++++++++++++++++- src/music/matrix.ts | 24 ++++ 9 files changed, 299 insertions(+), 29 deletions(-) diff --git a/src/components/MatrixGrid.vue b/src/components/MatrixGrid.vue index 2f8269d..b494875 100644 --- a/src/components/MatrixGrid.vue +++ b/src/components/MatrixGrid.vue @@ -1,9 +1,9 @@ diff --git a/src/components/PianoKeyboard.vue b/src/components/PianoKeyboard.vue index 84fc5c2..1f5e7f2 100644 --- a/src/components/PianoKeyboard.vue +++ b/src/components/PianoKeyboard.vue @@ -1,9 +1,6 @@