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

How to caculate "tick" properly?

humbleCoder1990 opened this issue · comments

스크린샷 2022-01-19 오전 2 00 21

I tried to make 1 bar with 16 notes.

So, I caculated durationTick like this.

const duration = 1920 / 16 /* 1920 ticks are 1 bar */

then,

const startTick = duration * noteIndex

But the result is almost 4 bars like the screenshot.
What are I missing something?
How to caculate ticks properly?

MidiWriterJS uses another value for meaning 1 bar of ticks?

Wow I just saw another post #58,
128 ticks for per beat.
It's very confusing.

Hi @humbleCoder1990,

That's correct, there are 128 ticks per beat. That's how it's specified in MIDI 🤷‍♂️