The keys LH/RH hand arc, the lift slice. split_hands was purely
heuristic (mean pitch vs middle C / largest-gap), so ANY edit to a keys
arrangement re-derived hand splits that could contradict the score's
authored grand-staff assignment — the documented "produces wrong hand
splits" failure, now that authored hands actually reach the wire
(editor #299 emits per-note `hand`; core #990 round-trips it).
- decode_wire_notes carries `hand` through ('lh'/'rh' strict enum;
junk → None so a hand-edited pack can't steer the split).
- split_hands: an authored hand always wins, and explicit notes are
REMOVED from their simultaneous group BEFORE the heuristic math runs
— one authored assignment must never skew its chordmates' guesses
(e.g. an authored LH melody note above middle C dragging the group
mean down and flipping the rest). All-explicit groups skip the
heuristic entirely; unassigned notes behave exactly as before.
Design per the piano-pedagogy review of the arc: binary lh/rh + absent
= unassigned; per-note explicit > heuristic precedence; crossing-hands
textures are exactly why the override is load-bearing.
Tests: five new in test_notation_lift.py (authored wins incl. a
crossing-hands case, group-removal-before-math with exact mean
arithmetic, all-explicit group, junk enum, decode carry-through); the
decode shape pin updated for the new key. Suite: 1723 passed (+5 vs
main; the pre-existing env failures reproduce identically on pristine
main).
Claude-Session: https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q
Signed-off-by: ChrisBeWithYou <chris@rifflarr.local>
Co-authored-by: ChrisBeWithYou <chris@rifflarr.local>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* fix: correctly import and notate multi-staff (piano/keys) tracks from GP8
Fixes bass stave being dropped on import (bar-column enumeration bug)
and wrong hand-split heuristic in notation_lift for chords straddling
middle C.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: byrongamatos <xasiklas@gmail.com>
* fix(gp-import): fold all grand-staff staves, per-stave tuning, playable hand-splits
Addresses review on #692 (topkoa):
- split_hands: only use the middle-C boundary when both resulting hands are
within HAND_SPLIT_SPAN_SEMITONES, else fall back to the largest-gap
heuristic — a hard middle-C split otherwise put a 19-semitone (unplayable)
span in one hand for bass-under-treble voicings (e.g. E2+B3 under an Em7
shape).
- Treat any multi-stave (grand-staff) track as keys end-to-end, so the
stave-0 and folded stave-1+ notes share one encoding and note_count (which
sums every stave column) matches what actually imports — closing the
phantom-count case for grand-staff instruments the name/program heuristics
miss (harp, celesta, marimba).
- Fold *every* extra stave (stave_columns[1:]), not just stave 1.
- Per-staff tuning fall-back to the track-level Tuning property so an untuned
staff never yields an empty pitch list (silent note loss); via a shared
_parse_tuning helper.
- Extract _collect_column_notes / _merge_lh_notes so the GPX LH/RH pair merge
and the GP8 grand-staff fold share one implementation and can't drift in
tie/timing/dedup handling.
- Rebuild filtered_to_raw from the already-computed stave_columns (one source
of truth for the counting rule) and drop the dead num_raw_tracks/raw_tracks.
Tests: grand-staff fold + bar-column offset (test_gp2notation.py); both
middle-C split cases (test_notation_lift.py). CHANGELOG updated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: byrongamatos <xasiklas@gmail.com>
---------
Signed-off-by: byrongamatos <xasiklas@gmail.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: byrongamatos <xasiklas@gmail.com>