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

Thread: Syncing midi clock across several outputs

  1. #1

    Syncing midi clock across several outputs

    I have been working on putting together a fairly elaborate midi controller that has 5 hardwareSerial midi outputs going to various Korg volca synths but I am having a difficult time implementing a way to sync then at all together.

    With the sendRealTime(clock) function, do I need to setup a running clock and send that function at the correct interval? Or do I need to send it as part of my actual function that will send my notes and sequences out? I can't seem to find a good breakdown of what the best practices or procedures are for this part of the process so any guidance is appreciated!

  2. #2
    Senior Member
    Join Date
    Jan 2017
    Location
    Maastricht
    Posts
    168
    Quote Originally Posted by massahwahl View Post
    I have been working on putting together a fairly elaborate midi controller that has 5 hardwareSerial midi outputs going to various Korg volca synths but I am having a difficult time implementing a way to sync then at all together.

    With the sendRealTime(clock) function, do I need to setup a running clock and send that function at the correct interval? Or do I need to send it as part of my actual function that will send my notes and sequences out? I can't seem to find a good breakdown of what the best practices or procedures are for this part of the process so any guidance is appreciated!
    You'd need to setup a running clock using a timer. This essentially runs independent of the other functions and sends out clock pulses to all serial port simultaneously.

  3. #3
    I have setup a timer using millis but I guess where I have gotten lost is with how to update all of the outputs at the same time? I have not been able to figure out the correct syntax to even send the clock function:

    MIDI1.sendRealTime(clock)

    Doesnít work and Iíve tried a few variations of it as well and canít get it to accept it.

  4. #4
    Senior Member
    Join Date
    Jan 2017
    Location
    Maastricht
    Posts
    168
    Quote Originally Posted by massahwahl View Post
    I have setup a timer using millis but I guess where I have gotten lost is with how to update all of the outputs at the same time? I have not been able to figure out the correct syntax to even send the clock function:

    MIDI1.sendRealTime(clock)

    Doesnít work and Iíve tried a few variations of it as well and canít get it to accept it.
    I'm not sure on the exact syntax as I only receive clock in my application. Assuming that you declared a serial midi as shown here: MIDI library and looking at the USBMidi syntax shouldn't it be MIDI1.sendRealTime(MIDI1.clock) ?

  5. #5
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,138
    I believe CLOCK is upper case.

    Edit.... not sure if it us in MIDI? I see examples on Ardunio forum with lowercase.

    Edit 2... on my tablet so I can't check, but the library defs seem to say it's title case: "Clock"

    Have you confirmed other MIDI is working?
    Last edited by oddson; 06-26-2019 at 08:06 AM.

  6. #6
    I did finally get it to work but it took some serious google-fu to finally find a good example that did it:

    Code:
    MIDI1.sendRealTime(midi::Clock);
    I was able to sync all 5 of my outputs by butchering someone elseís example by itís pretty gross looking, I have not been able to tear it down yet to only what I need:

    Code:
    void newTempo(int offset)
    {
        tempo += offset;
        if (tempo < TEMPO_MIN)
        {
            tempo = TEMPO_MIN;
        }
        else if (tempo > TEMPO_MAX)
        {
            tempo = TEMPO_MAX;
        }
        Timer1.setPeriod(calcTempoMicros());
    }
    
    void clockTick()
    {
        MIDI1.sendRealTime(midi::Clock);
        MIDI2.sendRealTime(midi::Clock);
        MIDI3.sendRealTime(midi::Clock);
        MIDI4.sendRealTime(midi::Clock);
        MIDI5.sendRealTime(midi::Clock);
        currentTick++;
        if (currentTick == 24)
        {
            currentTick = 0;
        }
    }
    I would like to get that cleaned up at some point but it does at least work to allow my rotary encoder to change the bpm

Posting Permissions

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