General
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.
Audience
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
- 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)
- You should use the Arduino IDE. Version 2.x is rather easy to use and works nicely with TeensyDuino
- Follow the TeensyDuino install-instructions provided at Teensyduino: Download and Install Teensy support into the Arduino IDE
- Create a folder for the attached zip-file and unzip MidiClock.zip files to this folder
- Open the files in the Arduino IDE (actually you open the folder)
- Set the USB Type (menu ‘Tools’) to MIDIx4
- Set the Speed to 150 MHz or higher (menu ‘Tools’)
- Verify the sketch: (menu ‘Sketch’)
- 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 , 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.
Stability
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.
Refinement
- 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) ***
MidiClock.zip (1.9 KB)
mclock_demo.gig (65.4 KB)
Update: forgot to mention you must select the board type also in the Tools menu (Teensy 4.1)