Skip to main content


Trying to asynchronously send a MIDI clock message, but the interval is always a bit longer than what I tell it to loop over. I tell it 120 beats per minute, but my MIDI device tells me it's clocking at 114 BPM.

Why is the loop interval not being honored with my code?

For the record, I am trying to wrap my head around asyncio but am obviously not using it correctly. Here is some code I cobbled together from brain/web:

gist.github.com/ology/2dc25326…

Help? 😀

#Python

in reply to Gene Boggs

It takes time to schedule the call, which means you need to carefully compensate to recalibrate the interval every time. This is what fritter.readthedocs.io/en/late… is designed to do.
Unknown parent

mastodon - Link to source
Gene Boggs
@glyph Thank you very much. I will try and figure out how to integrate fritter with my simple code. Any hints appreciated! 😁
in reply to Gene Boggs

I don't have any midi instruments here so I can't test it, but let me at least try to modify your sample
Unknown parent

mastodon - Link to source
Gene Boggs
@glyph YES!! This works perfectly! Haha. You rock!
in reply to Gene Boggs

this is a little tongue-in-cheek as this is a YouTuber thing to say and I am not (yet) a YouTuber. but I am obliquely referring to patreon.com/creatorglyph or github.com/sponsors/glyph