Manipulate two midi clocks

Antonis

Member
Hello Forum !!

I am building a project that is important to be able to receive two different midi clocks and use them in order to sync two different options . One midi clock is coming from DAW (Reaper) and the other from a plug in (Mobius Looper) . I am using the usbMIDI.setHandleClock(myClock); and it works perfectly for the main clock that I am receiving from DAW but how would it be possible to receive also the second clock without mixing them together.

Thank you for any help .
 
So... a clock isn't channel specific so you'd have to use two cables? Virtual in this case?


td_midi.html said:
When using virtual cables, getCable can tell you which virtual cable (0 to 15) received this message. This function always returns zero when virtual cables/ports are not in use.

https://www.pjrc.com/teensy/td_midi.html

I've never used them but this statement from the library page makes me think it's feasible. But I don't have direct experience with cables as I've never had the need.

Edit. ...although 'this message' is referring to SysEx so I don't know if that includes realtime... as usual I'm a bit out of my depth.
 
There's an example in Examples|Teensy|USB_MIDI|InputFunctionsComplete which might help. There is this comment in the myNoteOn handler which refers to the getCable function that @oddson mentioned:
// When using MIDIx4 or MIDIx16, usbMIDI.getCable() can be used
// to read which of the virtual MIDI cables received this message.
Presumably, you could expand the myClock function to call getCable to determine which device sent the clock message.

At the moment, I don't have anything to test this with, otherwise I'd try it.

Pete
 
I modified a MIDI test program I wrote to also read Note On messages and print which cable sent the message. I compiled it with USB type MIDIx4. Then I set up MIDI-OX on the PC to send notes to each of the four Teensy MIDI devices. The sketch does see the four different devices numbered from zero to three. I can't find a way to make MIDI-Ox send a system real time message such as the Clock but I presume that if you have two devices sending Clock, you'll be able to use getCable to distinguish between the two.

Pete
 
FYI: I found that a PC program called Pocket MIDI will send Clock messages. I modified the InputFunctionsComplete to print the identity of the cable for each Note On/Off and for Active Sensing and Clock.
Then set Pocket Midi to send the clock on different channels (only one at a time though). The code does identify the cable so you shouldn't have any problems distinguishing between the clock from a DAW and from a plugin.

Pete
 
FYI: I found that a PC program called Pocket MIDI will send Clock messages. I modified the InputFunctionsComplete to print the identity of the cable for each Note On/Off and for Active Sensing and Clock.
Then set Pocket Midi to send the clock on different channels (only one at a time though). The code does identify the cable so you shouldn't have any problems distinguishing between the clock from a DAW and from a plugin.

Pete

Thank you so so much for your time you spend to do for your experiments . Amazing !! Thank you !! again
 
Back
Top