grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.
MIT License
547 stars 58 forks source link

startTick option broken v1.7.4 #72

Closed binary-person closed 3 years ago

binary-person commented 3 years ago

A simple test to determine if a version of midi-writer-js is broken: https://github.com/grimmdude/MidiWriterJS/blob/1.7.0/examples/notes-by-start-tick.js

(note: I'm using midicsv to debug the midi files)

v1.7.[0-3] works:

0, 0, Header, 0, 1, 128
1, 0, Start_track
1, 0, Note_on_c, 0, 60, 64
1, 50, Note_off_c, 0, 60, 64
1, 50, Note_on_c, 0, 64, 64
1, 100, Note_off_c, 0, 64, 64
1, 100, Note_on_c, 0, 67, 64
1, 150, Note_off_c, 0, 67, 64
1, 150, Note_on_c, 0, 71, 64
1, 200, Note_off_c, 0, 71, 64
1, 200, Note_on_c, 0, 74, 64
1, 250, Note_off_c, 0, 74, 64
1, 250, Note_on_c, 0, 77, 64
1, 300, Note_off_c, 0, 77, 64
1, 300, Note_on_c, 0, 81, 64
1, 350, Note_off_c, 0, 81, 64
1, 350, End_track
0, 0, End_of_file

v1.7.4 doesn't work:

0, 0, Header, 0, 1, 128
1, 0, Start_track
1, 0, Note_off_c, 0, 81, 64
1, 50, Note_off_c, 0, 77, 64
1, 100, Note_off_c, 0, 74, 64
1, 150, Note_off_c, 0, 71, 64
1, 200, Note_off_c, 0, 67, 64
1, 200, Note_on_c, 0, 60, 64
1, 200, Note_off_c, 0, 64, 64
1, 250, Note_off_c, 0, 60, 64
1, 250, Note_on_c, 0, 64, 64
1, 300, Note_on_c, 0, 67, 64
1, 350, Note_on_c, 0, 71, 64
1, 400, Note_on_c, 0, 74, 64
1, 450, Note_on_c, 0, 77, 64
1, 500, Note_on_c, 0, 81, 64
1, 500, End_track
0, 0, End_of_file

For those who didn't bother reading the csv format, here's a quick info thing:

1, 0, Note_on_c, 0, 60, 64
1, 50, Note_off_c, 0, 60, 64
track, tick, event_type, channel, note, velocity
grimmdude commented 3 years ago

Hey @binary-person,

Thanks for the issue, I believe this has been resolved in v2.0.1 (https://github.com/grimmdude/MidiWriterJS/pull/75). Let me know if not if though.

-Garrett