Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Manipulate two midi clocks

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Location
    Skiathos, Greece
    Posts
    14

    Manipulate two midi clocks

    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 .

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,854
    EDIT: On second thought, I'm not sure how to handle that.


    Pete

  3. #3
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,414
    So... a clock isn't channel specific so you'd have to use two cables? Virtual in this case?


    Quote Originally Posted by td_midi.html
    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.

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,854
    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

  5. #5
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,854
    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

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,854
    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

  7. #7
    Junior Member
    Join Date
    Dec 2017
    Location
    Skiathos, Greece
    Posts
    14

    Quote Originally Posted by el_supremo View Post
    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

  8. #8
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,854
    You're welcome.

    Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •