grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Way to change timebase (ppq) instead of 128

MarmotCluster opened this issue · comments

I'm enjoying your package but have a problem.
I usually use the result file in fl studio. default timebase is 96.

// notes array
new NoteEvent({
    pitch: [getKeyAsString(i)],
    startTick: i * 128 * (0 / 96),
    velocity: Number((100 / 128) * 100),
    //even tried '128 * ((i + 1) / 96)' and 'Math.round(128 * ((i + 1) / 96))'
    duration: `T${Math.floor(128 * ((i + 1) / 96))}`,
})

so i rounded tick values and imported the midi file in software but it's not working as i thought.
dirtydesc

is there a way to set it manually for file?

Solved it by changing constants directly.