actually it is my turn to apologize because both my memory failed me and the comments matched my failed memory. (its possible that someone made a change without updating the comment.)
so anyways, util.time() does at least attempt to compute seconds, (sorry, again!) so i will look at jitter there… i’d be a little surprised, but who knows… writing some tests now and will report back.
(one thing that comes to mind is that MIDI clocks do have their own jitter, and you can’t always get a super clean BPM estimate without some form of filtering.)
and yes, for the specific use case of following link and MIDI, the new clock update has a simple tempo calc built into the C layer, which should bypass any timing problems from the event loop. (this is an awesome update from @artfwo, it is super fresh
so anyone who can use these features and doesn’t mind testing, may want to give it a spin)
(to be clear, my particular goal in this game is making sure that time() gives usable results for musical gestures in general.)
reporting:
using norns util.time() to measure a metro (which i know to be pretty accurate), at a typical kind of BPM (127bpm with 24ppq ticks), i get results that i would call quite good, and def. much better than is needed for BMP estimation. (in a nutshell, a sliding mean filter would give you estimation of dT accurate within 1 microsecond.)
using this script, bumping num samples up to 2048:
- absolute range of measured dT: just under 2 milliseconds.
- standard deviation: about 63 microseconds.
here’s the histogram:
and raw data if you want it
https://pastebin.com/U1vMMu4p
(oh, NB and [ed]: since original post i’ve updated the script to show error instead of raw dT measurements, which is easier to interpret)
there is also nothing else going on to interfere with event handling in this test. (which might not be the case when following midi clock.)
anyways i’d expect util.time() to be accurate even if the event loop is bogged.
TL/DR: i would look for other sources of jitter (like the event loop, esp. if there is a lot of graphics stuff going on; some changes are in the pipeline to address that particular timing bottleneck.)