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

time_signature_changes mismatch when using REMI tokenizer #73

Closed
Chunyuan-Li opened this issue Sep 22, 2023 · 2 comments
Closed

time_signature_changes mismatch when using REMI tokenizer #73

Chunyuan-Li opened this issue Sep 22, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Chunyuan-Li
Copy link

miditok version

2.1.5

Problem summary

When using REMI tokenizer, the time_signature_changes in the first measure will not be changed, but will use the default value '4/4'.

Steps to reproduce

import pretty_midi
midi = pretty_midi.PrettyMIDI(midi_path)
print("MIDI time_signature_changes:\n", midi.time_signature_changes)

from miditok import REMI, REMIPlus, TokenizerConfig, MIDITokenizer
config = TokenizerConfig(use_tempos=True, nb_tempos=240, tempo_range=(20, 259), use_rests=True, use_time_signatures=True, time_signature_range={8: (3,12), 4: (1,6)}, use_programs=False)
tokenizer = REMI(config)
tokens = tokenizer(midi_path)
print("MIDI tokens: \n", tokens)

Expected vs. actual behavior

MIDI time_signature_changes:
[TimeSignature(numerator=5, denominator=8, time=0.0), TimeSignature(numerator=8, denominator=8, time=2.5), TimeSignature(numerator=5, denominator=8, time=4.5)]
MIDI tokens:
[TokSequence(tokens=['Bar_None', 'TimeSig_4/4', 'Position_0', 'Tempo_120.0', 'Pitch_46', 'Velocity_79', 'Duration_0.2.8', 'Pitch_65', 'Velocity_79', 'Duration_1.0.8', 'Pitch_70', 'Velocity_79', 'Duration_1.0.8', 'Pitch_74', 'Velocity_79', 'Duration_1.0.8', 'Position_2', 'Pitch_58', 'Velocity_79', 'Duration_0.2.8', 'Position_6', 'Pitch_82', 'Velocity_79', 'Duration_0.2.8', 'Rest_0.2.8', 'Position_10', 'Pitch_82', 'Velocity_79', 'Duration_0.2.8', 'Position_12', 'Pitch_94', 'Velocity_79', 'Duration_0.2.8', 'Position_14', 'Pitch_82', 'Velocity_79', 'Duration_0.2.8', 'Position_16', 'Pitch_70', 'Velocity_79', 'Duration_0.2.8', 'Rest_0.2.8', 'Position_0', 'Pitch_46', 'Velocity_79', 'Duration_0.2.8', 'Pitch_70', 'Velocity_79', 'Duration_0.2.8', 'Position_2', 'Pitch_58', 'Velocity_79', 'Duration_0.2.8', 'Position_4', 'Pitch_70', 'Velocity_79', 'Duration_0.2.8', 'Position_6', 'Pitch_70', 'Velocity_79', 'Duration_0.2.8', 'Position_8', 'Pitch_82', 'Velocity_79', 'Duration_0.2.8', 'Position_10', 'Pitch_94', ...]

@Natooz
Copy link
Owner

Natooz commented Sep 22, 2023

Hey 👋,
Thank you for the bug report!
I'll take a look into it shortly and come back to you

@Natooz
Copy link
Owner

Natooz commented Sep 26, 2023

This is fixed and will be featured in the next update that will be released when #74 is fixed!

@Natooz Natooz closed this as completed Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants