I decided to use PPQ afterall to be able to change tempo and maybe later export as midi here is an imported JSON event.
{
"duration": 1.2000000000000028,
"durationTicks": 1920,
"midi": 53,
"name": "F3",
"ticks": 34560,
"time": 21.599999999999998,
"velocity": 0.6614173228346457
},
But it was a long time since i programmed it, i basicly forgotten how.
Lets say our ppq "parts per quarter" is 960.
So 4 * 960 is one bar 3850?
Lets say i have BPM is 100 for the note that is "2400 ms timelapse" in one bar?
But i am not sure i understand the millisecond calculation, although i can see how it is done.
60/100=0,6 seconds/beat to get it milliseconds * 1000 gives us 600 but why would that be a quarter note?
600*4=2400 someone that understand notes maybe can explain?
So to calculate number of bars 34560/3850 = 8,976623376623377 bars?
To get the time we take a bar 2400 * 8,976623376623377=21 543,8961038961 ms
Is it that simple is there just a rounding error above in the JSON, or is it maybe the realtime recording?
Well i think it is correct but maybe someone else interested in doing some javascript, it is much easier when writing things down.
Jonas T