Repository navigation
fix: play the selected cell's expected pitch from the piano keyboard and note picker - #130
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PianoKeyboard.vue/NotePicker.vueeach calleduseAudio().playNote(bareNote)directly, which always defaults to octave 4 regardless of the active puzzle cell.MatrixGrid.vue'snoteForColumnPlaybackinto a shared, exportedcomputePlaybackNotehelper insrc/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).note-clickinstead of playing sound themselves;PlayingView.vuecomputes the correct octave-qualified note for the active cell via the shared helper and plays it.Test plan
computePlaybackNotepure-function suite insrc/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)note-clickemit tests inPianoKeyboard.spec.tsandNotePicker.spec.tsPlayingView.spec.tstests proving octave-correct playback for given and non-given cells (dom9 puzzle,D5notD4)npm run lintnpm run test:unit -- --run(505 tests pass)npm run buildFixes #122