Is there some sort of scheduled callback mechanism?

I can see there’s a timer mechanism that goes down to 10 ms period which I can understand restricting a periodic timer to 10ms as it can get excessive running that frequently.

What I’m looking for is something like the ability to schedule a single callback for say 5ms from now.

With wind controllers they often have a deglitch mechanism to delay notes to smooth transitions without DDoSing NoteOns. I have one though that’s behaving a bit badly and doesn’t have that functionality and I was going to see if I can hack enough of a fix together on the Electra.

I was thinking I could register a NoteOn callback that only keeps track of the last note received and schedule a separate function for 5ms later (if one already isn’t active) which then fires the NoteOn message using that last note.

With timer enable/disable it looks like I’d be limited to 10ms granularity and 10ms may be a bit too much of a delay. Key delays are normally in the single digit ms range on the various wind controllers and waiting that long would probably feel like noticeable latency.

Does anyone have any suggestions? Thanks.

Try out if the following function would help you:
helpers.delay(5)

This should introduce a delay of 5ms in lua code. The function is brand new on the Mk2, and that one I haven’t tested yet. The function will be introduced on Mk1 as well, but that firmware isn’t out yet.

So a bit experimental for now.

I’m going to guess probably not as the documentation indicates it would stop LUA processing for that duration but I’d still need to have callbacks execute for the new NoteOns that come in during the window.