Skip to content

Feature: Midi - make it possible to handle 'SystemRealTime' events synchronously#643

Merged
stephenhensley merged 2 commits intoelectro-smith:masterfrom
HeckHeckHeckHeck:midi_rt_callback
Apr 1, 2026
Merged

Feature: Midi - make it possible to handle 'SystemRealTime' events synchronously#643
stephenhensley merged 2 commits intoelectro-smith:masterfrom
HeckHeckHeckHeck:midi_rt_callback

Conversation

@HeckHeckHeckHeck
Copy link
Copy Markdown
Contributor

Sync more precisely to a Midi clock signal.

@willemOH
Copy link
Copy Markdown
Contributor

willemOH commented Oct 4, 2025

@HeckHeckHeckHeck with your digging into midi clock, do you have any thoughts on this issue?

@HeckHeckHeckHeck
Copy link
Copy Markdown
Contributor Author

HeckHeckHeckHeck commented Oct 6, 2025

its just a "back of the envelope" design suggestion prototype. Works for me (perfectly actually).
should probably be shaped and polished a bit little after merge.

@TomFrost
Copy link
Copy Markdown

TomFrost commented Jan 1, 2026

+1 on this -- I've been ripping my hair out why my Seed inexplicably thought my MIDI channel was switching to 9 spontaneously. I just wrote my own fix at master...TomFrost:libDaisy:fix/midi-parser-running-status to detect the RTClock message before the parser resets. I should have looked here first. IMO @HeckHeckHeckHeck 's solution is more elegant, but I'll keep mine here for reference if it's worthwhile to anyone.

@stephenhensley
Copy link
Copy Markdown
Collaborator

This looks like a solid starting point for improvements with realtime handling to me!

I'll be looking at this and the new related (running status fix) PR early next week.
I'll let you know if there's any feedback, but it looks okay at a glance!

Thanks for the contribution!

@stephenhensley
Copy link
Copy Markdown
Collaborator

I merged the more passive realtime-related PR first so that I could test this on top of it, and make sure everything seemed to be consistent (mostly since this is opt-in, and that one may resolve some issues people were running into).

Just finished testing this out a bit and comparing between the two modes, and everything seems to work great in the few cases I tested it.

I didn't make any practical programs that would take advantage of the improvement yet (though I do have a few projects that I think could benefit from this update).
However, I have some changes to the MIDI_UART_Input example that allow for selecting between the realtime callback or not, and log timestamps of when the message was handled by the application, and the source (queue, or real time callback). I used this modified example to do some testing on the hardware and validate the changes.
I'll add that once this is merged so it can act as a sort-of demo to using the new feature.

Thanks again for the contribution, @HeckHeckHeckHeck!

@TomFrost It looks like the changes in #643 implement the fix that you had staged. So everything should be pretty solid in the System Realtime now.

@stephenhensley stephenhensley merged commit 8521f44 into electro-smith:master Apr 1, 2026
@HeckHeckHeckHeck
Copy link
Copy Markdown
Contributor Author

cool, thanks. appreciated. And yeah i went for min code change philosophy here to clearly communicate intent basically, so no design beauty, but, been using it since more than a year now in many little programs, always worked reliably, even on stage ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants