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

Fix issues in Octuple with multiple different-beat time signatures #146

Merged
merged 3 commits into from
Feb 12, 2024

Conversation

ilya16
Copy link
Contributor

@ilya16 ilya16 commented Feb 12, 2024

Hi! I've been playing around with miditok>3.0.0 and found two bugs in the Octuple encoding:

  1. Octuple tokenizer with multiple time signatures with different beat values (e.g., time_signature_range = {2: (1, 2), 4: (1, 4), 8: (1, 8)}) encodes and decodes positions so that they are shorter than in the original MIDI. For example, note positions in */4 bars are decoded twice as short within the bar. The example MIDI in Incorrect Placement of Time Signatures #131 will not be decoded correctly if there is a time signature */8 in the config.
    image
    Solution: adapt the position encoding logic from REMI to Octuple.
  2. The duration of the first note after the time signature change might be encoded incorrectly.
    Solution: move the processing of time signatures above the note duration.

📚 Documentation preview 📚: https://miditok--146.org.readthedocs.build/en/146/

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (37e28ed) 91.22% compared to head (4d98f7a) 91.01%.
Report is 1 commits behind head on main.

Files Patch % Lines
miditok/tokenizations/octuple.py 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #146      +/-   ##
==========================================
- Coverage   91.22%   91.01%   -0.21%     
==========================================
  Files          33       33              
  Lines        4978     4985       +7     
==========================================
- Hits         4541     4537       -4     
- Misses        437      448      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ilya16 ilya16 marked this pull request as draft February 12, 2024 13:16
@ilya16 ilya16 marked this pull request as ready for review February 12, 2024 13:36
Copy link
Owner

@Natooz Natooz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thank you for the fix(es)!
I'll definitely have to include MIDIs with more complex time configuration in the tests

@Natooz Natooz merged commit e793368 into Natooz:main Feb 12, 2024
13 checks passed
@ilya16 ilya16 deleted the fix-octuple-positions branch May 30, 2024 15:09
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 this pull request may close these issues.

None yet

2 participants