MidiClk clock tester/generator

MidiClk

MidiClk is a high precision MIDI Clock tester/generator which allows you to check MIDI Clock quality with great precision 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_098 (use midiclk_pal.syx if your device has MIDIpal bootloader)

Source code: MidiClk_097_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.

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

58 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.

    • 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s