Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send a midi out clock? #89

Open
moebiussurfing opened this issue Nov 22, 2024 · 4 comments
Open

How to send a midi out clock? #89

moebiussurfing opened this issue Nov 22, 2024 · 4 comments
Labels

Comments

@moebiussurfing
Copy link

Hey @danomatika ,
I checked your MIDI input clock receiver example and it works fine.

Do you have some implementation/example of sending a MIDI clock to a MIDI Out port?
I would like to integrate here https://github.com/moebiussurfing/ofxBeatClock.

Any help is appreciated.

Regards

@danomatika
Copy link
Owner

I don't. The MIDI spec is pretty stringent on timing, so an OS-agnostic fast & accurate timer is required. When I first added this part, there wasn't anything available in C++ without having to do a bunch of platform-specific stuff but now there should be. The protocol is pretty simple, so it would be adding a function to take the time and output an array of bytes for the timer to send out. The best solution is probably to have the timer run in it's own thread if it is not callback-based.

@moebiussurfing
Copy link
Author

moebiussurfing commented Nov 23, 2024

Hey @danomatika
I think that I made it work!

I just tested to receive play/stop and beat ticks and tempo to Ableton Live (Windows 11 & macOS / OF 0.12.0) and it worked!
(I am unsure if the time position is included in the MIDI protocol...)

I did the code assisted with Anthropic Claude, so I am not sure if that is optimal or redundant.
It seems to be platform-agnostic too.

I posted a repo to check by yourself if you like.
Of course, feel free to include it as an example here in ofxMidi.

https://github.com/moebiussurfing/TEST_MidiOutClock

@moebiussurfing
Copy link
Author

moebiussurfing commented Nov 23, 2024

oops! bad news.
now I see that there's some difference between bpm master/slave tempos...

@moebiussurfing
Copy link
Author

moebiussurfing commented Nov 23, 2024

well. now is better but requires some seconds (~10) to finish syncing the correct bpm.

389229441-e3d33578-6de9-48e6-942d-ee126b28faf1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants