Skip to content

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

Description

@jpsmith8488

Environment: music21 10.5.0, Python 3.14, macOS.

Summary: BrailleGrandSegment.extractHeading (braille/segment.py, the SIGNATURE branch) tests isinstance on the grouping container instead of the element:

try:
    keySignature, timeSignature = useElement[0], useElement[1]
except IndexError:
    if isinstance(useElement, key.KeySignature):   # container, never true
        keySignature = useElement[0]
    else:
        timeSignature = useElement[0]              # a lone KeySignature lands here

useElement is a grouping (list-like), never a KeySignature, so a mid-piece key change with no simultaneous meter change (a SIGNATURE grouping holding only a KeySignature) falls into the else, is passed to transcribeSignatures, which reads m21TimeSignature.symbol (braille/basic.py) → AttributeError: 'KeySignature' object has no attribute 'symbol', aborting the transcription.

Fix sketch: test the element rather than the container: isinstance(useElement[0], key.KeySignature).

Reproduction sketch: a two-part keyboard score with a key change (no meter change) at an interior measure, transcribed via braille.translate.keyboardPartsToBraille.

Related, found while tracing: the warning path of handleArticulations (braille/basic.py) references music21Note.editorial.fingering, which does not exist — the except branch itself raises AttributeError when a fingering fails to transcribe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions