DIY hardware midi-clock

Some time ago I someone triggered me to see whether I could turn a Teensy into a midi-clock device (24 times midi-message 0xf8 per beat). I tried and I could so here are the files. @dhj uses a software solution with M4L for this, so you might like to look into that first.

It is not very hard to compile the project and upload it to a Teensy, but of course when you’ve done nothing of the sort before, it is a whole new universe…

Compiling and programming

  1. Buy yourself a Teensy 4.x. Without it, it won’t work, unless you already posses a Teensy you can use. It might also work with a Teensy 3.6, but I did not test that, so in that case you’ll be out on your own. At the moment prices are somewhere around $32.00. Teensy® 4.1. (You do not need a _LOCK version: these are meant to be protected to reverse-engineering)
  2. You should use the Arduino IDE. Version 2.x is rather easy to use and works nicely with TeensyDuino
  3. Follow the TeensyDuino install-instructions provided at Teensyduino: Download and Install Teensy support into the Arduino IDE
  4. Create a folder for the attached zip-file and unzip files to this folder
  5. Open the files in the Arduino IDE (actually you open the folder)
  6. Set the USB Type (menu ‘Tools’) to MIDIx4
  7. Set the Speed to 150 MHz or higher (menu ‘Tools’)
  8. Verify the sketch: (menu ‘Sketch’)
  9. When it compiles fine:
    9.1 Attach your Teensy 4.x using an micro-usb cable to your computer
    9.2 Set the port to the Teensy (menu ‘Tools’)
    9.3 Upload the sketch: (menu ‘Sketch’)

After this, you will be enriched by the experience :smile:, and when you connect the Teensy, it can provide a midi-clock on 4 midi-devices (all provided by the Teensy).
Attached also a gigfile (GP 4.5) that can start, stop and adjust the clock.

The clock itself is rather stable. It is, however, probably the way Windows handles incoming usb-midi-messages that introduces some jitter. Good thing is that GP compensates it rather well, and when message A is .2 beat too fast message B and C are probably .1 too slow, so it kind of corrects itself. Of course, it can be the case that this is not stable enough for your purpose.


  • You can adjust the device-name, vendor and/or the serial-number in ‘names.c’. When you want to attach two or more Teensys with this firmware, assigning different serial-numbers helps WIndows to keep the devices apart. Changing the device-name will help you keep the devices apart
  • When you set the USB Type to MIDIx16, you will have the Teensy act as 16 midi-devices

*** Disclaimer: Using this software (the sketch as well as the gigfile) is on your own risk. Furthermore, you may use it as you seem fit. I take no responsibility whatsoever. ***

*** I only tested the Teensy-midi-clock-device using Windows (11) *** (1.9 KB)
mclock_demo.gig (65.4 KB)


Created a (sort of) improved version. This version also includes the control of a TM1637 display (these are rather inexpensive) which shows the current tempo. Officially it use 5V, but just connect the 5V connection of this display to the 3.3V of the teensy.

If you don’t want to use the display, just comment out the define ‘#define use_display 1’ at the top of the .ino file.

The video shows it in action (being adjusted using gp (mclock_demo.gig) (2.3 KB)