-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
There seems to be an issue merging parts by staff (i.e., using reassign="staff"
) if the certain non-note elements do not have staff information.
This is a minimal example to reproduce the issue (see attached MusicXML file):
import partitura as pt
score = pt.load_musicxml("28.xml")
part = pt.score.merge_parts(score.parts, reassign="staff")
Running this code results in the following error message:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-7-922f1ddd307d> in <module>
----> 1 part = pt.score.merge_parts(score.parts, reassign="staff")
~/Repos/partitura/partitura/score.py in merge_parts(parts, reassign)
4705 elif reassign == "staff":
4706 if isinstance(e, (GenericNote, Words, Direction)):
-> 4707 e.staff = e.staff + sum(maximum_staves[:p_ind])
4708 elif isinstance(
4709 e, Clef
The solution should be fairly straightforward: simply assign staff number 1 to the elements that do not contain information, so that e.staff
is always an integer.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working