MidiClk clock tester/generator

MidiClk

Note: MidiClk firmware is replaced with MidiClock and MidiSync firmwares and is not supported anymore.

MidiClk is a high precision MIDI Clock tester/generator which allows you to check MIDI Clock timing accuracy and generate super stable MIDI Clock synchronous to the incoming MIDI Clock. With MidiClk you can finally use your DAW as a clock source for hardware sequencers, arpeggiators, and synthesizers!

Latest firmware:  MidiClk_099 (use midiclk_pal.syx if your device has MIDIpal bootloader)

Source code: MidiClk_099_src

To switch between MIDI Clock Tester and MIDI Clock Generator modes, power up MidiGAL while holding down the switch.

In MIDI Clock Tester mode, MidiClk measures incoming MIDI Clock accuracy and stability. The clock accuracy is displayed as BPM value from 8 to 300BPM. Stability is displayed as standard deviation expressed as a percentage of the average BPM value. Both values are sampled over the period of four beats (96 MIDI clocks).

MIDI Clock Tester mode user interface:

  • pressing the switch clears current statistics
  • clicking the encoder immediately updates statistics which is automatically updated every second
  • double clicking the encoder toggles “max” versus “current” standard deviation display

The picture below shows MidiGAL running MidiClk firmware connected to an old Alesis SR16  (1990) which appears to have reasonably good clock stability (0.5%), but lousy clock accuracy: 121.26 vs 120 BPM.

MidiClk_SR16#1

The same Alesis SR-16 running at 250 BPM into frequency meter which would measure precisely 100 Hz if SR-16 clock frequency would be exactly 250 BPM:

Alesis_SR16_250BPM

Note that 101.05 Hz average MIDI Clock frequency and 12.47 mHz standard deviation measured by the frequency meter perfectly match MidiClk Tester measurement for the same period:  101.05 Hz  is equal to 252.625 BPM. Minor difference in standard deviation is caused by the fact that frequency meter calculated statistics over 1384 samples whereas MidiClk did it only over the last 96 samples.

Alesis_SR16_250BPM#2

In MIDI Clock Generator mode, MidiClk generates super stable MIDI clock with BPM selected by the encoder or measured by sampling MIDI Clock events received on MIDI IN.

MIDI Clock Generator mode user interface:

  • pressing the switch starts/stops MIDI clock generator
  • clicking the encoder toggles tempo selection mode (to a tenth of a beat)
  • rotating the encoder selects configuration pages (see below)
  • solid arrow to the left of the BPM count means clock generator has locked in on the incoming clock
  • hollow arrow to the left of the BPM count means that the incoming clock is detected but not yet locked in on
  • right arrow to the right of the BPM count means the slave device has been started

Pictures below show Clavia’s Nordbeat 2  Performance Step Sequencer running on iPad at 100 BPM connected to MidiGAL with MidiClk firmware via Griffin Technology StudioConnect Audio/MIDI interface:

MidiClk_iOS#1

First MidiGAL (with white on black LCD) shows quality of the MIDI clock coming from NordBeat2. As it is typical for software sequencers running on modern multitasking operating systems, the outgoing MIDI clock accuracy is good, however it’s stability is horrible: 1% or even worse. At 1% BPM varies from 99 to 101 during 4 beats!

Second MidiGAL (with black on yellow LCD) measures incoming clock frequency, rounds it to the closest integer BPM value, and generates synchronous stable clock. The number in the second line shows the difference between the number of MIDI Clock events received and sent. Since the computer-generated MIDI Clock instability is random, this number usually wanders around zero.

Third MidiGAL (with white on blue LCD) analyses stable MIDI clock generated by the second MidiGAL. As you can see, it’s two orders of magnitude better than the clock generated by NordBeat2 it started with. At 0.005% standard deviation it’s good for sample accurate rhythmic delays and instant groove!

MidiClk_iOS#2

To prove MidiClk generator accuracy and precision, here are results of MidiClk MIDI Clock Generator test after running at 250 BPM overnight. As you can see, frequency stayed close to 100.005 Hz during the entire test period, with the standard deviation less than 17 uHz.

MidiClk_clock_genrator_250BPM_overnight

Hold mode

Starting with firmware version 0.95 MidiClk supports Hold Mode which is inspired by Mutable Instruments MIDIpal Sync Latch mode, which, in turn, was inspired by the Mungo Sync. This mode allows the slave device to be temporarily stopped and re-started in sync with the master device playing a loop. In this mode the Start and Stop actions caused by pressing MidiClk switch are essentially quantized at the selected measure.

Step Length and Step Number pages specify duration and number of steps for the Hold Mode measure. For example, selecting a quarter note (1/4) and 4 will stop and restart slave device at the next bar measure.

Hold Mode page allows you to select if only Start or both Start and Stop actions will be quantized.

Other configuration pages

RoundBPM page forces measured BPM to an integer value. Set this to “on” if your MIDI Clock source is so unstable that it causes MIDI Clock tracker to jump to the nearest tenth of a beat value.

Threshold page specifies a numeric factor that defines when MidiClk decides that the input MIDI clock is stable. Set this to a minimal value that still allows the input clock icon (triangle arrow to the left of the BPM value) to be a black triangle most of the time.

ConstClk page specifies if MIDI Clock event are constantly sent to MIDI OUT or only between MIDI Start and Stop events.

PassThru page specifies if events other than MIDI Clock/Start/Continue/Stop are passed through to MidiClk’s MIDI OUT.

Strobe page specifies the width of the strobe pulse: 1ms to 5ms.

All the configuration parameter are saved in nonvolatile memory and remembered when MidiClk is switched off.

Sync24 output

Starting with firmware version 0.96 MidiClk Clock Generator uses MidiGAL’s extension ports to output Sync24 signals:

  • Pin2: ground
  • Pin3: Sync24 (24 PPQN)
  • Pin4: Step pulse (set by Step Length page to 1/64 triplet, 1/32 triplet, 1/32 note, 1/16 triplet, 1/16 note, etc… all the way to 2 whole notes)
  • Pin5: Step count pulse (set by Step Count page to a number from 1 to 96 which multiplies the value set by Step Length page)
  • Pin6: Start/Stop

Pins3-5 output positive going pulses with width specified by Strobe Width page whereas Pin6 goes high on Start/Continue and low on Stop. All signals are 0-5V.

The picture below shows pins 4 and 5 with Step Length set to 1/64, Step Number set to 4, running at 250 BPM with 1ms pulse width:

MidiClk_Strobes

85 thoughts on “MidiClk clock tester/generator

  1. Hey, I’m having an issue with uploading new firmware and was hoping you could help.
    I can’t seem to upload a new firmware via sysex. I boot into firmware update mode with the encoder pushed down when I turn it on, and then send the sysex file. The MIDI IN led turns off when I start the transfer, but doesn’t blink for every received packet and doesn’t restart into the new firmware when the upload is complete. I have tried with a few different interfaces that I have handy, but I can’t completely rule them out as the issue. Could I be doing something else wrong?

  2. sorry to bug you again here pete, i am just slowly discovering all these awesome devices. would the MidiClk send out MMC start/stop commands on the button press aswell? i am seeking for a midiclock generator that can do tenth BPM to drive my mmt-8 (or later: the midirex), this seems like a very good solution.

    • Currently MidiClk does not send MMC start/stop commands. It only sends standard MIDI Start/Stop events, which is enough to control most devices out there including mmt8 and MidiREX.

      • ok great thanks! i am not fully knowledged on midi standards, i always thought MMC start/stop is the most simple thing that is sent out, did not know that there is an even more simple standard midi command. but when it works with mmt-8 and midirex thats great! i am now calculating demand and preparing to order some boards and atmegas 🙂

      • Hi Pete!
        Have you ever thought about MMC/MTC again? I am looking for a way to control an old Akai DR-8 with my vintage Roland MC-500. I know it´s 2021 and a DAW could replace both. But I like these old machines.

      • It’s still on the list, however, it keeps being pushed back due to other, much more popular requests. I just bumped it up again, to see if it gets its chance.

    • I thought about it but could not find suitable UI to activate it< so left it out for now. The only feasible option at thsi point is to tap switch while holding down the encoder.

  3. I was thinking of adding a 1/4″ mono female plug on the box so a tap tempo pedal could be plugged in and used on a guitar pedal board or even by a keyboard player.

    Maybe 2 points can be provided on the pcb where the wires can be soldered?

      • You could use a foot pedal that controls the button itself… Just need to secure that so you don’t fry the cpu if you accidentally plug in the wrong thing to it. I’m planning to do this .. one day.

  4. just gathered all the parts together for my build and a question popped up in my mind – i sometimes work with tape and found it easier just to record a bpm click to sync simple devices to that, since most sequencers cannot be slaved to fsk and output midi clock at the same time… would there be an option to add an audio input for a click onto the midigal/midiclk, to slave it to a click track and generate midiclock from that? or any other things i could do to sync to tape with it?

    • This is doable, however not exactly trivial: first of all you’ll need to add some external circuitry to shape up your click signal (amplify, limit, then sent through Shmidtt trigger to form the 0-5V pulse signal that can be consumed by the MCU, then modify firmware code to initialize that input port and poll it at the same 5KHz interrupt MidiGAL uses to handle MIDI.

      • thank you for the elaborate answer, i thought that it will not be too easy/needs some effort. it is a pity there are no pins left for the tap tempo, else i would have tried to condition the trigger and send it there. i finished soldering the MidiGAL yesterday and it works just like expected, rock solid! it fits nicely into a hammond HM-1591STCL enclosure, though the upper corners of the board need to be chopped a bit to fit, or the screw threads standoffs in the case can be removed and the board and enclosure cover mounted with spacers only – or if case mounted connectors are used the pcb can stay centered in the case… lots of options. can’t wait to get the midirex up and running aswell 🙂

      • maybe the case can be even modded so that the pcb fits with the connectors on board, as the thread standoffs in the case are also molten to the edge, they could be removed partially with a sidecutter so only the top part with the screw remains and the circuit board with spacer sits below. also this case leaves good space for adding TS jacks or whatever is demanded for the sync signals below the pcb. I almost have the unit finished in case and i tried to sync my PO-12 to the step pulse yesterday, but i noticed the step pulse is always running. I assume this is bound in with the midi clock, but it’s somewhat hard to sync a drummachine on the “1” to that. also turning the unit off and on (my botch workaround) does not work, as somehow the unit is skipping the first beat on the step pulse on powerup. Is it possible to attach a reset button to the circuitboard that restarts the atmel so that the first step pulse equals the first midiclock? Like, unit is halted as long as reset is pressed, when i release it it starts again at beat 1. Another option would be to have the step pulse (+ count pulse) only enabled when start/stop is pressed, but i guess for other users it will be more useful to have the pulses turned on all the time. I was wondering, how are my settings stored, is this in eeprom? I am only worried that it may wear out sooner from that, i would find it acceptable when these settings are not stored permanently if it increases the lifetime of the eeprom.

  5. ok, as my programming skills are not so skillful, i found another way to solve it. since the start/stop pin only goes high on playback i was adding a bc547b used as switch, adding a 1.2k resistor between transistor base and pin 6 (had these parts flying around), emitter goes to ground, collector is used as switched ground. step pulse still coming from pin 4, ground coming from transistor collector when playback is started. sync problem solved 🙂

  6. ok i changed it around so that the start/stop pin is switching the step pulse with the transistor. it “swallowed” the first impulse when i didn’t use hold mode, also when i had the po-12 in a full setup (before i used it “floating” with internal speaker), it got ground from it’s audio output jack so of course the switched ground didn’t work. just writing this if someone plans to do the same. resistors are 2k2 on base (start/stop pin) and 1k on collector (step pulse), output jack tip on emitter.

  7. So if I understand it I would need just one MidiGAL to stabilize any clock source, whatever that may be. I can pass the clock along then to I assume to multiple devices via a multi output MIDI thru box and everything would sync up stable. Am I correct?

  8. i use it as standalone clock and sometimes to test – when we had a pc, running minimal processes, with cubase and a rme fireface – by ear the midiclock seemed totally stable, but MidiClk showed a deviation of nearly 5% and it was never stable! on my trustee boss br864 it was only 0.2% deviation, but stable. we use mostly hardware, so the MidiClk became the main clock and the fireface is only recording note events and audio tracks. MidiClk is unmatched, not even commercial products can do what it does with such precision. i am thinking of ordering more, just to have a backup and trying the other firmwares.

  9. Question: Does MidiClk require a source to generate (taking a source and correcting it then passing it along) or can it just generate clock on it’s own? I’m wondering if having a continuous clock source I can have everything that’s receiving clock fall in line instantaneously as there is no wind up period as a clock starts and everything synced to the clock starts up as well. If this makes any sense.

    • MidiClk can certainly serve as a stand alone accurate MIDI Clock source. Continuous clock indeed allows units to align before they receive MIDI Start command, what you say makes perfect sense.

    • Yeah, MIDIpal firmware has divider app. This app forwards every incoming MIDI message, but it only picks every Nth clock message. This has the effect of slowing down the MIDI clock by a ratio of N.

  10. When using MIDIClk to “clean” a received clock, I notice MIDIClk is pretty solid at lower tempos. But, at higher tempos (180-ish and beyond), MIDIClk spits out jittery and drift-y clock. Seems way worse than what I get out of my DAW with USB. I have tried all sorts of combinations of Threshold and Round, etc. Any ideas?

  11. for my personal use i have never needed more than 130bpm, but natively direct from the unit. when you are fixing external clock with the midiClk, be sure that it just receives clock, nothing else.

    • Yep – I’m familiar with the serial nature of MIDI, so I was not sending anything else but clock. I noticed I was getting like a 5-6% deviation on my source clock when used the clock tester.

  12. the thing is, is it musically relevant for you to go faster than 180 bpm? sure a bold question, but it does not always make sense to benchmark technical values. even my atari ST has a lot of deviations when measured with the midiClk, but insider sources claim that the atari has a fixed latency of between 1 and 15mS iirc (or 20), so the notes will always be off but sound less robotic that way, but never so much off that it’s unmusical. some midi sequencer like the mmt8 slaved to the midiclk gives you that exact precise robotic tone. …that for putting a different light on deviations

  13. The midiClk clock is jittery and drift-y even around 130bpm IIRC. I am only mentioning the higher tempos, since the issue seems to gradually get worse at higher tempos; higher the tempo, the worse the issue. That observation might be useful for debugging.

  14. Here is my test:
    1. Setup Ableton to send MIDI sync out of RME UFX MIDI port 1.
    2. Setup Elektron Analog RYTM (AR) to receive clock and transport.
    2. Plug MIDI cable from RME UFX MIDI port 1 directly into AR.
    3. Set AR to output its metronome.
    4. Record about a minute of AR’s metronome.
    5. Notice the recorded audio is quite solid for the whole minute.
    6. Unplug the MIDI cable from AR, and plug it into MIDIGal’s input.
    7. Run another MIDI cable from MIDIGal’s output into AR’s input.
    8. Record about a minute of AR’s metronome.
    5. Notice the recorded audio is jittery and noticeably drifts as the time goes on.

    Thanks for taking a look.

      • With RME disconnected, MidiClk output is solid even at 200bpm.
        With RME connected, AR drifts and jitters at 200bpm, and MidiClk’s left triangle flashes often even with Threshold == 25.
        With RME connected, AR is pretty solid at 100bpm, and MidiClk’s left triangle does not flash very often with Threshold == 25. But, at 100bpm, there is still some drift, albeit less than the drift at 200bpm.

  15. I tried uploading MidiClk 0.99 on my MIDIBud. The syx file seems to transfer OK but during the install the MIDIBud freezes, displaying “Wait 96”. MidiArp and midipal firmwares both load OK…

    • “Wait 96” is what MidiClk MIDI Clock Tester shows upon start. It waits for MIDI Clock events to be received.

      If you want to switch MidiClk to MIDI Clock Generator mode, power it pressing the switch.

      • Thank you. I was pressing the left-most switch on the MIDIBud (which put it in bootloader mode). It works when pressing the right-most switch

  16. Hi, the MidiGAL seems like a magical device that might fix the sloppy sync issues I am having running Ableton Live as the master clock. I am currently using the MIDI output from the audio interface to send clock and other messages such as MIDI notes to several synths on different MIDI channels. If I use MidiClk between my interface and a midi thru box to stabilize the clock from Ableton, will I need an extra device to merge the MIDI clock and the other MIDI messages being sent out from the DAW or will the MidiGAL still send both clock + other messages out from it’s midi output?

    • MidiClk passes all other MIDI messages from IN to OUT unchanged, it only stabilizes the Clock events. So no, no merging is necessary, just stick it in between you DAW MIDI OUT and MidiThru that distributes MIDI stream to your devices.

  17. Pingback: Published MidiClock firmware | MidiSizer

  18. Hi Pete. I own a MIDIbro (Audiothingies) and it also has the MIDI Clock “app” in it. Do you happen to know if the code in there is the same as your MidiClk?
    Also, another thing: do you think that with your MidiClk it would be possible to have more than one physical MIDI OUT and also the possibility to have some shift range between the different outputs (yes, I’m thinking about the E-RM MultiClock’s feature)?
    Thanks and regards,
    Flavio.

    • I have no idea what MIDIbro has inside… MidiClk is open source, so its code is available for adaptation.

      The microprocessor used in these projects has only one serial interface, so adding anoter MIDI IN/OUT port is not really possible. One will need ATMega644 to do that.

      • Hi Pete, thanks for your quick reply.
        Am I right saying that MIDIbro, MIDIpal and MIDIgal are pretty similar? Or are there quite some differences worth taking into account?
        As of today, I own a MIDIbro and never thought about using it as my MIDI master clock – I used Roland SBX-1 for this purpose and now I might swap over to Cirklon’s clock. But still: if there is a tighter and better MIDI clock generator, I might go for that one. Any suggestions?
        Thanks,
        Flavio.

  19. I have an Arturia Keystep Controller/Sequencer which has no display. You can set the Clock Tempo with the rate knob or with the Tap Tempo button but there is no way on the unit to know what the BPM is. Even though I’m sure there is some drift, it is un noticeable. What I really need is just a display showing the BPM. Is it possible to have just a BPM readout device maybe connected to the CV out on the Keystep? I need the Midi out jack on it for other modules. I’m guessing that the MidiGAL would work but the Keystep was actually less expensive than that. Too bad that Arturia didn’t put a display window on it.
    Thanks

    • I use one of my MidiGALs with MidiSync firmware with KeyStep all the time. Keystep MIDI OUT is connected to MidiGAL’s MINI IN, and MidiGAL’s MIDI OUT goes to the synth rack. Displays actual BPM and also adds beat precise Start/Stop (aka Hold Mode) which is super useful.

  20. Hi Pete! I am trying to create a custom version of the midiclk firmware that only changes 0,1 BPM with every encoder turn, no matter how fast it is turned. I found a part in clock_generator_page.cc which i edited. I never coded/compiled much, so i am now running into issues compiling with WinAVR, maybe you can please give me a hint what i am doing wrong?

    “C:/WinAVR-20100110/utils/bin/sh.exe”-2.04$ make
    avrlib/makefile.mk:200: build/midiclk/depends.mk: No such file or directory
    makefile:27: build/midiclk/depends.mk: No such file or directory
    mkdir -p build/midiclk/
    /WinAVR/bin/avr-g++ -MM -mmcu=atmega328p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR -DxENABLE_DEBUG_OUTPUT -DATMEGA328P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/adc.cc -MF build/midiclk/adc.d -MT build/midiclk/adc.o
    process_begin: CreateProcess(NULL, /WinAVR/bin/avr-g++ -MM -mmcu=atmega328p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR -DxENABLE_DEBUG_OUTPUT -DATMEGA328P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/adc.cc -MF build/midiclk/adc.d -MT build/midiclk/adc.o, …) failed.
    make (e=2): The system cannot find the file specified.
    make: *** [build/midiclk/adc.d] Error 2

  21. Hey Pete.

    I have a Ditto 4x looper pedal which can take incoming MIDI clock to sync loops. Will I be able to use MidiClk as a standalone MIDI clock generating unit. Your description states the MidiClk can “generate super stable MIDI Clock synchronous to the incoming MIDI Clock”.

    What is unclear to me from this description is if the MidiClk can generate a MIDI clock as a standalone unit.

    Would I be able to use the MidiClk (and no other equipment) to send a midi tempo to my Ditto 4x looper pedal? If yes, how would I accomplish that on the unit itself? Thank you!

    • Sure! If no input clock signal is present, MidiClk genegates the clock it is set to or the last one it received.

      BTW, MidiClk is obsolete and replaced by MidiClock an MidiSync firmwares which do everything MidiClk did, but with more precision and accuracy, and more functionality. The one you need for your needs is MidiSync.

  22. Hi, I’ve been browsing your site for sometime, could find all the info I needed, but can’t find where to obtain the pcb for the MidiGAL/midiclk. Where can I buy the pcb? Thanks!

      • Oh, somehow I’ve been convinced the device was capable of doing this. Maybe, because that’s the only feature I’m interested in, I was hoping for the best. Is there any way you implement a +/- clock shift in the nearby future? Can’t effort the ERM Multiclock at all…

Leave a comment