Skip to content

fix: play the selected cell's expected pitch from the piano keyboard and note picker - #130

Merged
privera-git merged 1 commit into
mainfrom
fix/note-input-octave-playback
Jul 13, 2026
Merged

privera-git merged 1 commit into
mainfrom
fix/note-input-octave-playback

Conversation

@privera-git

Copy link
Copy Markdown
Owner

Summary

  • PianoKeyboard.vue/NotePicker.vue each called useAudio().playNote(bareNote) directly, which always defaults to octave 4 regardless of the active puzzle cell.
  • Extracted the octave-computation math from MatrixGrid.vue's noteForColumnPlayback into a shared, exported computePlaybackNote helper in src/music/matrix.ts (includes the fix: enharmonic spellings crossing the B/C seam (Cb, Cbb, B#, B##) play one octave off #121 unbounded-chroma fix).
  • Both input components now emit note-click instead of playing sound themselves; PlayingView.vue computes the correct octave-qualified note for the active cell via the shared helper and plays it.

Test plan

  • New computePlaybackNote pure-function suite in src/music/__tests__/matrix.spec.ts (F-major fixture + fix: enharmonic spellings crossing the B/C seam (Cb, Cbb, B#, B##) play one octave off #121 edge cases + synthetic/unanswered-cell case)
  • MatrixGrid.spec.ts's existing "ascending column playback" tests pass unchanged (delegation produces identical output)
  • New note-click emit tests in PianoKeyboard.spec.ts and NotePicker.spec.ts
  • New PlayingView.spec.ts tests proving octave-correct playback for given and non-given cells (dom9 puzzle, D5 not D4)
  • npm run lint
  • npm run test:unit -- --run (505 tests pass)
  • npm run build

Fixes #122

…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
@privera-git
privera-git merged commit 29a0db2 into main Jul 13, 2026
2 checks passed
@privera-git
privera-git deleted the fix/note-input-octave-playback branch July 13, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: keyboard/note-picker input always plays octave 4 instead of the selected cell's pitch

1 participant