Skip to content

(AI) Braille: read a lone key signature in a keyboard segment heading - #2087

Merged
mscuthbert merged 1 commit into
cuthbertLab:masterfrom
wolfgang-aura:fix-1986-braille-keysig
Oct 19, 2026
Merged

mscuthbert merged 1 commit into
cuthbertLab:masterfrom
wolfgang-aura:fix-1986-braille-keysig

Conversation

@wolfgang-aura

Copy link
Copy Markdown
Contributor

Fixes #1986: keyboard braille no longer aborts with AttributeError: 'KeySignature' object has no attribute 'symbol' when a segment opens with a key change and no meter change.

BrailleGrandSegment.extractHeading tested isinstance on the grouping rather than its element, so a grouping holding only a KeySignature was passed on as the time signature. As you suggested in the issue, the SIGNATURE branch now walks the grouping and takes the first KeySignature and the first TimeSignature, without assuming their order or count.

test_keyboardInteriorKeyChangeWithoutMeterChange in braille/test.py builds an 8-measure keyboard score with a BrailleSegmentDivision and a change to two sharps at measure 5, and checks the exact braille. It fails at master with the error above and passes with this change.

How this was tested

pytest music21/braille passes (73 tests), and python -m music21.braille.<module> passes for basic, segment, translate, test, noteGrouping, text, objects and lookup, which also runs their doctests. Windows, Python 3.14 only.

I left the handleArticulations fingering warning path that the issue also mentions for a separate change.

🤖 Generated with Claude Code

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 93.381% (+0.002%) from 93.379% — wolfgang-aura:fix-1986-braille-keysig into cuthbertLab:master

@mscuthbert

Copy link
Copy Markdown
Member

LGTM -- Thank you!

@mscuthbert
mscuthbert merged commit ad34dd4 into cuthbertLab:master Oct 19, 2026
8 checks passed
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.

Keyboard braille: extractHeading passes a KeySignature where a TimeSignature is expected (isinstance tested on the container)

3 participants