Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/miditok/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,11 @@ def get_bars_ticks(score: Score, only_notes_onsets: bool = False) -> list[int]:
# Mock the last one to cover the last section in the loop below in all cases, as it
# prevents the case in which the last time signature had an invalid numerator or
# denominator (that would have been skipped in the while loop below).
time_sigs.append(TimeSignature(max_tick, *TIME_SIGNATURE))

# When only_notes_onsets is True, we add an extra tick because otherwise, when
# the last onset coincides with a start of a bar, it will be excluded because
# range() is exclusive of the endpoint.
time_sigs.append(TimeSignature(max_tick + int(only_notes_onsets), *TIME_SIGNATURE))

# Section from tick 0 to first time sig is 4/4 if first time sig time is not 0
if (
Expand Down
Loading