tekartik / midi.dart

Library for manipulating and sequencing Midi files, tracks, events
BSD 2-Clause "Simplified" License
34 stars 6 forks source link

Incorrect timestamp on other track #28

Closed TSKangetsu closed 1 year ago

TSKangetsu commented 1 year ago

image

channel 5,6,7 doesn't look right, about 2 seconds delay here, this only appear in multiple channel

TSKangetsu commented 1 year ago

image This mid file appears to have 2 BPM metadata,will this cause problems?

alextekartik commented 1 year ago

That could likely be the issue since I don't think I encounter this yet (and I think I have a single time signature per file). Would you be able to share the midi file so I can take a look?

TSKangetsu commented 1 year ago

we_shall_die_togetherunknown.zip

alextekartik commented 1 year ago

Indeed, it seems I need to handle the time signature slightly differently to handle this properly. I'll look into it and keep you posted

alextekartik commented 1 year ago

I don't see anything wrong with the file, indeed channel 6,7,8 start later. Just to understand, did you generate this file with this lib, do you have any problem playing it with a midi player or are you noticing something special I should look at?

TSKangetsu commented 1 year ago

I use flutter_midi_command to play it, when i remove 120bpm meta, only 140bpm, it play normally. If file has multiple bpm, some track won't play with correct time, file tracks 5、6、7 still get 120bpm timestamp image

TSKangetsu commented 1 year ago

May be midi_file_player problem? I'm still checking the code.

alextekartik commented 1 year ago

Ok I think I understand, indeed midi_file_player assume a fixed time/tempo signature. I'll check how I can improve that.

alextekartik commented 1 year ago

Indeed the time computation in MidiFilePLayer was wrong when there was a bpm change. I think this is fixed