JzzMidiAccess has a bug that prevents it to read midi values from js object#105
Conversation
e13mort
commented
Feb 23, 2026
- Manually read values from js object in a loop
- use Date.now() function for timestamp calculation
- update JzzMidi library to 1.8.6
…object and use current Date object to obtain timestamp
|
Thanks for the PR! I have a question about your timestamp changes:
Doen't Date.now() hold time in milliseconds? It seems like we need 1000000 there. |
MDN says that it's in milliseconds https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now If that's true do we need multiplication by 1_000_000? |
|
Yes, that's my point. I'm actually not sure if Date is better than DOMHighResTimestamp. Date sounds compromising to me, but I have no strong preference. Thoughts? |
|
I see a few possible solutions here:
Personally I'd prefer the second option. The first one fits too, because my goal was to fix ByteArray bug at the first place. The third option is likely the right one, but it requires more research in order to achieve the consistent behaviour. |
|
OK, thanks. I agree to your points. Can you update your changes so that the time unit matches to nanoseconds? |
|
Great!
Yes, I was sure that it's 1000, not 1000000. such a shame :) |
Fix millis to nanos conversion
|
Awesome, thank you so much! |
|
@atsushieno Hi. Do you have any plans to publish a new version with that fix? |
|
New release would come up with the latest/updated dependencies, and currently I've been occupied by Android audio stack and have no time to verify them. You need released ktmidi packages only if you are distributing libraries. If you are just building apps, you should be able to resolve the deps by building ktmidi and installing it into |
|
Approach with |
|
|
ktmidi package is up on Maven Central. Thanks for your patience! |