Skip to content
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

Parsing error when skipping invisible objects in partially invisible chords #419

Open
leleogere opened this issue Jan 22, 2025 · 0 comments · Fixed by #401
Open

Parsing error when skipping invisible objects in partially invisible chords #419

leleogere opened this issue Jan 22, 2025 · 0 comments · Fixed by #401

Comments

@leleogere
Copy link
Collaborator

I recently added the option to skip some invisible objects when parsing a score in #401.

While it seems to work the majority of times, I've found a specific case where it triggers an assertion error, in the ASAP score
Chopin/Etudes_op_25/2, measure 118:
Image

This is a very weird case, I can't really understand the purpose of this notation, but the thing is that only part of the chord is invisible, and therefore, it can trigger the following assertion error:

chord = e.find("chord")
if chord is not None:
# this note starts at the same position as the previous note, and has
# same duration
assert prev_note is not None
position = prev_note.start.t

I did not investigate deeply, but I guess that the first note of the chord is invisible, therefore skipped. Then the parser gets to the next note, that has the tag <chord/>, and therefore the parser expects that it also has the attribute prev_note pointing to the first note of the chord. However, as it has been skipped, this attribute is still None, and the assertions fails.

I do not really see in which cases one would mark invisible only parts of a chord, but it can definitely happen, and I do not really know how we could deal with that.

Do you have any idea on how this could be managed? I guess that the best way would be a clean implementation of a visible tag, resulting in always parsing all elements and marking their visibility status in an attribute, allowing the user to skip them manually. However, this would require far more work than the simple approach I took in #401.

@leleogere leleogere changed the title Parsing error when skipping invisible objects in a specific case Parsing error when skipping invisible objects in partially invisible chords Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant