Syncing midi clock across several outputs

Status
Not open for further replies.

massahwahl

Active member
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!
 
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.
 
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 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) ?
 
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:
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
 
Status
Not open for further replies.
Back
Top