-
Notifications
You must be signed in to change notification settings - Fork 430
More accurate spanner stop/start on import (and make import of exported MusicXML from those scores work, too) #1768
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
base: master
Are you sure you want to change the base?
Conversation
…o longer trip over intervening <backup> and <forward> elements, and also so we take into account the offset attribute of the direction.
…here they were assigned.
…e endElement.offset and endElement.activeSite, which are cleared by the operation.
MusicXML export: final <forward> jump to end of measure was jumping too far.
Time to work on some test coverage. |
@mscuthbert This is ready for review. |
…fsets, making sure that (1) the spanners in the two imported scores have the same offsets in the score, and (2) that there are no overlapping GeneralNotes in the streams containing either end of each spanner.
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.
Hi Greg -- sorry to take some time on this. I'm noticing some changes on Crescendo attachment that I want to discuss a bit more -- returning to conversation.
music21/musicxml/xmlToM21.py
Outdated
since bwv66.6 uses it) | ||
* New in v7. | ||
* New in v7. Stubbed out in v9.7. |
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.
For stubbed out, say "deprecated in v9.7 (not needed, so does nothing. To be removed in v10.0)"
I was being a bit lazy, perhaps? I can use self.nLast as the start element of a direction spanner, but only if it has the correct offset. Same with "whatever the next GeneralNote is", but that logic will be a bit trickier, since when that next note shows up is potentially a fair bit later (and in a few different places in the code), and we'll need to have the "correct offset" info saved off somewhere, so we can (1) check it, and (2) create and insert a SpannerAnchor at the correct offset if necessary. I'm not sure what happened to fill(), but I will say that it is used successfully for Ottavas all the time (so that transpose() can work properly), with a Stream argument (if you don't pass in a Stream, it falls back to using getFirst().activeSite). So perhaps the no-stream-argument case isn't well-tested (or activeSite was not the stream you wanted). I'll take a look. I will work on making both of these changes (only use SpannerAnchors if you have to, and fix Spanner.fill as necessary). |
Thanks! re fill(): Yeah, I don't see an example in the docs of filling between multiple measures so it's possible that hadn't been properly implemented. sigh. :-D |
…les where there is NO next note after a spanner start.
I think that fill() should require a stream argument (and perhaps allow a list of streams, for the case where pedal marks should be filled from both left and right hand staves of a piano part within an orchestral score). I think I was being too helpful when I allowed None, implying sp.getFirst().activeSite. That's almost never useful. |
@mscuthbert Tests look like they will pass, so this PR is ready to go. The most controversial change here is, I believe, that I modified makeRests to insert split rests instead of a complex duration rest. If you're not up for that, I can undo it; it was briefly necessary, but I believe it isn't necessary anymore. |
Added comment pointing to cuthbertLab/music21#1768 which addresses the MusicXML parser limitation with preserving crescendo/diminuendo wedges.
Sigh... I merged 9.7.1 (master) back into this PR, and tests are failing. I'll investigate. |
I'm so sorry -- I don't remember making changes that were supposed to affect this. |
Oh I'm definitely not blaming you! My current theory is a bad merge (user error, or git error). I'll figure it out. |
It was indeed a bad merge of xmlToM21.py. |
@mscuthbert this is ready for review (unless you want me to remove the makeRests change). |
…ts have an associated required offset and clientInfo (if not specified, behaves as before). (2) new API insertFirstSpannedElement (3) new API popPendingSpannedElements. Also a fix that saves/restores spanner element offset/activeSite around operations that clear them.
Converting to draft, waiting for the split-out PRs to land. Then I'll remerge, and make sure everything still tests clean. First step is to remove the makeRests change that was rejected. |
Hi -- is this about fixing behavior if |
No, now that I have removed the makeRests change you rejected, this PR no longer has anything to do with makeNotation=False. (I will double check the diffs to be sure.) |
For the record, run_tests (3.12) failure was a "coveralls is not responding" error. Hopefully that will be fixed well before I turn this back into a non-draft PR. |
…reAccurateSpannerStartStop
Import of
<direction>
spanners now always generate SpannerAnchors, and take direction@offset into account. This also fixes some bugs where self.nLast and "whatever the next GeneralNote is" weren't the right things to use.Export of SpannerAnchor-based spanners produces "extra jumpy" MusicXML files (lots more
<backup>
and<forward>
elements), which are valid, but unusual, and import of those "extra jumpy" files needed some fixing here as well.