-
Notifications
You must be signed in to change notification settings - Fork 91
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
Switch to Symusic #116
Switch to Symusic #116
Conversation
@Yikai-Liao things are moving, the test for one-track tok-detok are all passing! When everything is done on the MidiTok side, I'll try to contribute to symusic by adding a few tests on the CI pipeline, to ensure the robustness of the parsing/dumping processes. |
…ck events methods
@Yikai-Liao we are almost done here! ![]() Hopefully when this is resolved we will be ready to review and merge! |
Oh, I forget to change the tempo factory. I add qpm is to make it more clear that this property refers to quarters per minute, But I'm still not sure, should I use this abbreviation? For the tempo factory, I think users should be able to choose one of These two arguments(microseconds per quarter and quarters per minute) as the argument of the constructor. Because in some kind of situations, we could just use qpm for convenience, but in other cases, we might need to avoid any precision loss by passing a int. Two possible signatures might be __call__(self, time, qpm=None, mspq=None)
# or
__call__(self, time, quarter_per_min=None, ms_per_quarter=None) I'm not sure which one is better for users. |
I agree with you for letting the choice to the user. |
@Natooz TempoFactory have been fixed Yikai-Liao/symusic#14 |
Thank you! |
I only store mspq(int) in the struct. So I think currently there is no Information loss. So why do you need to define a custom Oh, are you considering the Information loss when creating tempo by qpm? |
Thank you for the clarifications! Is there a reason to sort notes and pedals by end value? |
The reason is that if we only need to sort by attributes, we could directly generate (by macro ) For example, we could write sort function like this: sort(vec, key = "tpdv") {
if(key == "tpqd"):
return sort_tpdv(vec)
} But if we don't do it, we will need to write a simple jit strategy, which would be hard. Although relection is possible solution, it seems quite tricky in c++. And I don't know how implement it. |
I'm not qualified to give advice on how to achieve it, but I'll just suggest to maybe sort by default by |
Preprocessing results from 56fdaef
Here the durations (of notes and pedals) are also preprocessed, by being aligned to the values of the tokenizer's vocabulary (except for MIDILike which is not concerned). When omitting note sorting
|
I have added sort for note and pedal while parsing midi. And the default sort key for NoteList and PedalList are changed to (time, pitch, duration) and (time, duration). The new wheels (0.2.4) are building now. |
Wonderful! |
@Yikai-Liao this is great!
Thank you once again for your reactivity! Concerning this PR, the switch is almost done, there is only this issue on Windows that I'll be fixing soon. When this is done, I think we will be reading to merge this (enormous) PR. |
… pitch bend preprocess, _ticks_to_duration_tokens optimized
…ts for specific complex MIDIs
utf8 file path support on Windows is added in librarify branch which will be merged to the main branch soon. |
@Yikai-Liao The bug happening on Windows was due to the § character in the file name of the MIDI being dumped. In MidiTok, this is done in the data augmentation method to tag the augmentation information in the file name. It turns out that symusic raises an iostream error when trying to load a file with this character in the name. I simply switch from I only have one task left before merging this PR! 🙌 |
I see our minds were synced here 🥲 |
…ve invalid ones in _preprocess_time_signatures, tokenize_midi_dataset applies BPE in midi_to_tokens
@Yikai-Liao @lzqlzzq There are still some bugs and improvements that I want to do/fix before releasing the next release (v3.0.0). You'll be noticed when the changes will come. |
Following #112, this PR switches the MIDI load/write backend from miditoolkit to symusic.
@Yikai-Liao @lzqlzzq