Closed MarkGotham closed 1 year ago
Thanks for the great bug report Mark! Can you simplify the file to the smallest one that causes the bug (removing any symbols that don't cause the crash?) -- For instance m2-m7 and replacing m1 with just a single token?
For comparison, here's a couple of other failing cases (same issue):
Thanks for the great bug report Mark! Can you simplify the file to the smallest one that causes the bug (removing any symbols that don't cause the crash?) -- For instance m2-m7 and replacing m1 with just a single token?
Pleasure! And good shout!
rntxt = """
Time Signature: 4/4
m0 b4 f: i
m1 V
Note: Do not use internal notes with anacruses!
m2 i
"""
thanks!
(also for the pieces, but the path to a fix is rarely through more complex cases but through simpler)
Even smaller:
rntxt = """
Time Signature: 4/4
m0 b4 f: i
Note: Do not use internal notes with anacruses!
m1 V
"""
thanks!
(also for the pieces, but the path to a fix is rarely through more complex cases but through simpler)
True, I guess my head is still in "identifying the issue" mode for which hundreds of complex example were needed! Unfortunately, I came across this in the midst of a 300 measure case in which there might have been any number of causes. Anyway, enough autobiography!
ah! so nothing to do with the repeats!
Running right now in ipython
%debug romanText.translate.romanTextToStreamScore(rntxt)
which shortens the debug time a lot! It's in "fixPickupMeasure"
Figured out the problem! whooy what a doozy:
we are iterating backwards from the end of the stream to move anything after the last measure backwards BUT then the stream gets sorted again so that we keep iterating over the same RomanTextUnprocessedMetadata object forever.
hard to diagnose. should be easy fix.
Fantastic!
fix is in as #1532 -- gotta go.
music21 version
Latest, dev.
Problem summary
A few (c.1%) of apparently well-formed rntxt files fail to convert, and after a lot of counterfactual variant testing, the issue seems to be with the combination of anacrusis + internal notes.
By way of an example, here's a short song by Louise Reichardt https://github.com/MarkGotham/When-in-Rome/blob/master/Corpus/OpenScore-LiederCorpus/Reichardt%2C_Louise/Zwölf_Deutsche_und_Italiänische_Romantische_Gesänge/03_Durch_die_bunten_Rosenhecken/analysis.txt
Steps to reproduce
This raises
IndexError: tuple index out of range ... IndexError: attempting to access index -11 while elements is of size 10
Workaround
Note:
line and all's well (converts fine,.show
works, etc.). That's consistent with the11
vs10
issue mentioned by the error (11 lines with the note and the anacrusis) ... but ...Note:
to above the first bar or after the last, that's fine. That actually is a perfectly workable solution in this case, but not in longer (N hundred measure) examples.At present, I'm afraid I do not have a proper solution to report. If I work figure one out I'll PR it. Grateful for any others taking a look. And thanks to @malcolmsailor for confirmation/replication