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

No way to change HEADER_CHUNK_DIVISION #131

Open jonhallur opened 4 months ago

jonhallur commented 4 months ago

The writer is using 128 for ticks per quarter note. The old midi standard was 48 (twice that of the old SMPTE 24 pulses per quarter note) and many later programs started using 96. Many modern sequencers are using either 480 or 960.

Looked at the code, and seeing how the HEADER_CHUNK_DIVISION is used to convert note durations to ticks in static function, I can think of no good way to change this with the current architecture.

grimmdude commented 4 months ago

Hi @jonhallur, yea the HEADER_CHUNK_DIVISION value is currently defined as a constant without a way to change it programmatically. Sounds like it would be useful to add a method to change this during runtime.