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

Update tests in fill rests function (referring to develop) #355

Open
manoskary opened this issue May 14, 2024 · 1 comment
Open

Update tests in fill rests function (referring to develop) #355

manoskary opened this issue May 14, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@manoskary
Copy link
Member

Need to add extensive testing to the validity of fill_rests function that infills incomplete voices with rests.

@manoskary manoskary added documentation Improvements or additions to documentation enhancement New feature or request labels May 14, 2024
@manoskary manoskary self-assigned this May 14, 2024
@leleogere
Copy link

You might want to have a look at the Chopin/Etudes_op_25/2/xml_score.musicxml score in the ASAP dataset, as partitura fails to fill rests in it:

import partitura as pt

pt.score.fill_rests(
    pt.load_musicxml(
        "/home/user/datasets/asap-dataset/Chopin/Etudes_op_25/2/xml_score.musicxml"
    ).parts[0],
    measurewise=True,
)

Traceback:

IndexError                                Traceback (most recent call last)
Cell In[61], line 1
----> 1 pt.score.fill_rests(pt.load_musicxml("/home/user/datasets/asap-dataset/Chopin/Etudes_op_25/2/xml_score.musicxml").parts[0], measurewise=True)

File ~/Applications/partitura/partitura/score.py:5723, in fill_rests(score_data, measurewise)
   5721 if measurewise:
   5722     for measure in measures:
-> 5723         _fill_rests_within_measure(measure, part)
   5724 else:
   5725     note_array = part.note_array(include_staff=True)

File ~/Applications/partitura/partitura/score.py:5541, in _fill_rests_within_measure(measure, part)
   5539 min_start_note = notes_per_vocstaff[sort_note_start[0]]
   5540 if min_start_note.start.t > start_time:
-> 5541     sym_dur = estimate_symbolic_duration(
   5542         min_start_note.start.t - start_time,
   5543         part._quarter_durations[0],
   5544         return_com_durations=True,
   5545     )
   5546     # solution when estimation returns composite durations.
   5547     if isinstance(sym_dur, tuple):

File ~/Applications/partitura/partitura/utils/music.py:769, in estimate_symbolic_duration(dur, div, eps, return_com_durations)
    766     return copy.copy(SYM_COMPOSITE_DURS[j])
    767 else:
    768     # NOTE: Guess tuplets (Naive) it doesn't cover composite durations from tied notes.
--> 769     type = SYM_DURS[i + 3]["type"]
    770     normal_notes = 2
    771     return {
    772         "type": type,
    773         "actual_notes": math.ceil(normal_notes / qdur),
    774         "normal_notes": normal_notes,
    775     }

IndexError: list index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants