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

Tuplet errors when parsing some scores #386

Open
leleogere opened this issue Oct 8, 2024 · 1 comment · Fixed by #387
Open

Tuplet errors when parsing some scores #386

leleogere opened this issue Oct 8, 2024 · 1 comment · Fixed by #387
Assignees
Labels
invalid This doesn't seem right

Comments

@leleogere
Copy link

Hello,

I'm currently bulk processing scores from the (n)-ASAP dataset, and I'm facing tuplet errors when loading some scores. They might be due to a bad MusicXML encoding, but I thought that it might be interesting to report them here in case the issue comes from Partitura.

The reported error is the following:

Traceback (most recent call last):
  File "/home/user/test.py", line 236, in <module>
    score = pt.load_musicxml(path)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/env/lib/python3.12/site-packages/partitura/utils/misc.py", line 68, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/env/lib/python3.12/site-packages/partitura/utils/misc.py", line 90, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/env/lib/python3.12/site-packages/partitura/io/importmusicxml.py", line 255, in load_musicxml
    _parse_parts(document, part_dict)
  File "/home/user/miniconda3/envs/env/lib/python3.12/site-packages/partitura/io/importmusicxml.py", line 370, in _parse_parts
    position, doc_order = _handle_measure(
                          ^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/env/lib/python3.12/site-packages/partitura/io/importmusicxml.py", line 588, in _handle_measure
    (position, prev_note, prev_beam) = _handle_note(
                                       ^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/env/lib/python3.12/site-packages/partitura/io/importmusicxml.py", line 1391, in _handle_note
    starting_tups, stopping_tups = handle_tuplets(notations, ongoing, note)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/env/lib/python3.12/site-packages/partitura/io/importmusicxml.py", line 1456, in handle_tuplets
    start_tuplet.start_note.start.t < stop_tuplet.end_note.start.t
AssertionError: Tuplet start time is after tuplet stop time

Here is a list of a few affected files. There might be more, but I haven't tested the whole dataset yet, I can update this list later if needed.
Bach/Prelude/bwv_874
Balakirev/Islamey
Beethoven/Piano_Sonatas/13-4
Beethoven/Piano_Sonatas/16-2
Beethoven/Piano_Sonatas/17-3
Beethoven/Piano_Sonatas/18-3
Beethoven/Piano_Sonatas/22-1

@manoskary manoskary self-assigned this Oct 10, 2024
manoskary added a commit that referenced this issue Oct 10, 2024
@manoskary manoskary added the invalid This doesn't seem right label Oct 10, 2024
@manoskary
Copy link
Member

Hello Leo and thanks for your issue, it is indeed slight issues with the scores, I propose to relax the condition to start_tuplet.start_note.start.t <= stop_tuplet.end_note.start.t

@manoskary manoskary linked a pull request Oct 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants