-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional attributes to tuplets related to their time modification #414
Conversation
… import/export related
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice addition to Partitura to cover better support of tuplets in musicxml . Review contains only minor comments, suggestions, and questions
I case you have planned to merge this right now, do not yet, I've found an issue I would like some insights about. I'll explain in a comment on the related code in a few minutes. |
The issue I mentioned is about the following assert: assert tuplet_actual_type == tuplet_normal_type, "Tuplet types are not the same" Initially, I thought that the However, the tag belonging to <tuplet number="1" placement="below" type="start">
<tuplet-actual>
<tuplet-number>13</tuplet-number>
<tuplet-type>eighth</tuplet-type>
</tuplet-actual>
<tuplet-normal>
<tuplet-number>4</tuplet-number>
<tuplet-type>quarter</tuplet-type>
</tuplet-normal>
</tuplet> This piece contains a lot of occurrences of The way MuseScore deals with it seems to be to convert the Therefore here is my question, should I separate the I would be interested in your insights about this issue @manoskary |
Hello Leo and thanks for the detailed message. It is true that we tend to find the weirdest things in score encodings and this would not be only example for sure. Generally, I would recommend using the option that would not break the parser. In this case I think separating the type could actually be a good solution for the import, in order to respect the encoding. For the export, I would use the MuseScore solution so it does not break. As always add some inline comments explaining why. Would this solution sound reasonable to you? |
I think separating the type might be the cleanest solution. However, if I separate the type, don't you think that I can simply export it as is? With the two different types as it was in the original xml? |
I've split the |
Ok thanks let me run some tests before merging |
Found a problematic cadence parsing while parsing large corpora for testing. I incorporate the fix on this PR since it is very minor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running some tests on bigger Musicxml sets, loading and exporting is not failing therfore I will move forward with merging this PR. If in the future we notice, incorrect visualizations of tuplets, maybe we can rethink the export part.
As I explained in #405, I thought that tuplets objects were missing some information about the rhythmic modifications they induce (actual notes, normal notes and type). In MusicXML scores, tuplets elements can contain this information in
<tuplet-actual>
and<tuplet-normal>
tags, but usually, they do not need to be specified and can be inferred from the<time-modification>
tags of notes. Actually, MuseScore only exports such tags in case of nested tuplets as<time-modification>
tags result from the multiplication of the different nested ratio.Currently, Partitura does not parse those tags, and therefore some information is lost in case of nested tuplets. Even in the case of simple single-level tuplets, I feel that this information should be accessible at the
Tuplet
object level, in addition to the note level.This PR allows exactly that, by adding optional
actual_notes
,normal_notes
andtype
attributes, that are parsed from the MusicXML<tuplet-actual/normal>
tags if present, and otherwise inferred from the first note of the tuplet.This also adds a property
duration_multiplier
to theTuplet
similarly to what music21 proposes (which is simplynormal_notes/actual_notes
).I also implemented it at export time, always outputting the tags
<tuplet-actual/normal>
no matter if they are absolutely needed or only optional, I don't think that it could cause any issue?