Replies: 1 comment 2 replies
-
I'm afraid I do not but it would be an interesting addition to WebMidi.js (in fact, I added it to the Enhancements to evaluate section of the wiki). If I had to do it, I would pretty much go the same route. That is:
Instead of using an array, you could also use a smoothing factor (which would probably be a cleaner solution). There is an example of this here: https://github.com/yderidde/PGMidi/blob/master/Sources/PGMidi/PGMidiSession.mm#L186 If you ever end up with a satisfying solution and don't mind sharing, I would love to see what you came up with. Cheers! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Every synth with midi sync can easily establish the current BPM from the clock messages stream, but all my attempts to calculate it from clock timestamp events give a very unstable number and seem too heavy for the CPU.
My current idea is to circularly fill an array with differences between current and previous clock timestamps and then iterate over that array to calculate the exact BPM. I came up to this formula
bpm = 60000 / ((ev.timestamp - prevTimestamp) * PPQ)
Where I gotPPQ = 24
for my OP-Z. But all my actual implementations are buggy and slow.Is there an optimized way to calculate it more fast and precisely? I think it's a rather common question and there should be a community approved optimal way to get the number. May be some ArrayBuffer can make the calculations fast and reliable?
@djipco Do you have any experience with that?
Beta Was this translation helpful? Give feedback.
All reactions