Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions music21/musicxml/xmlToM21.py
Original file line number Diff line number Diff line change
Expand Up @@ -2556,6 +2556,11 @@ def getStaffNumber(mxObjectOrNumber) -> int:
pass
except AttributeError: # a normal number
pass
if mxObject.tag in ('staff-layout',
'staff-details',
'clef'):
# for this subset of number'ed tags, no number means staff 1
return 1
return NO_STAFF_ASSIGNED
else:
return NO_STAFF_ASSIGNED
Expand Down Expand Up @@ -6011,13 +6016,17 @@ def handleClef(self, mxClef):

>>> MP = musicxml.xmlToM21.MeasureParser()
>>> MP.handleClef(mxClef)
>>> MP.lastClefs
{0: <music21.clef.TrebleClef>}
>>> MP.lastClefs[1]
<music21.clef.TrebleClef>
>>> MP.lastClefs[0]
<music21.clef.TrebleClef>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test was insufficient before and it's insufficient now too -- since we have no tests of what this did before. I'll make a push onto this.


>>> mxClefBC = ET.fromstring('<clef number="2"><sign>F</sign><line>4</line></clef>')
>>> MP.handleClef(mxClefBC)
>>> MP.lastClefs[2]
<music21.clef.BassClef>
>>> MP.lastClefs[1]
<music21.clef.TrebleClef>
>>> MP.lastClefs[0]
<music21.clef.TrebleClef>
'''
Expand Down
Loading