simple MIDI for Teensy microcontroller boards
Visit the GitHub page to download this code.
I’m a big fan of the Teensy microcontroller family. They are small, cheap, have plenty of ins and outs, and you can turn them into USB MIDI devices really easily (or many other types of standard USB devices). The Teensy 3 and LC also have a bunch of “touch pins” built in, which means you can just attach any bit of metal to them and they’ll become capacitive touch sensors.
I would highly recommend them to anyone embarking on building a custom MIDI controller – Arduino gets all the headlines, but the Teensy is really much better for that kind of thing. If you are sticking to MIDI devices the LC version will do everything you need at a low cost.
However, it can be tricky to get started. I’ve managed to put together a piece of code which is relatively flexible and can be used for any number of combinations of buttons/knobs/touchpins/etc.
This code was made in the Arduino environment and should work with any of the Teensy boards. The only exception is the touch pins, which will only work on Teensy 3 or newer, as well as the older and now-discontinued LC.
The code has comments to show you where to input the number of pins you want to have each function, and which specific pin numbers to use for each function. For MIDI notes there are arrays where you can specify which notes to use.
This code also outputs Serial data simultaneously, though this is not very well documented. It allows for much higher resolution control, provided you are able to interpret the Serial data.
Get in touch if you have any questions or if you run into any trouble.