- No products in the cart.
Teensy USB MIDI Controller Code
- Categories Resource
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 3.1 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.
So 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.
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.
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. The different available functions in version 1.0 are:
- Analog inputs to send CC values
- Digital inputs to send note values
- Digital inputs to send CC values
- Touch pins to send note values (with constant velocity)
Still to do:
- Add ability to specify specific CC assignments for analog and digital inputs
- Add ability to use Touch pins as CC (this is trickier…)
You’ll have to set the serial port to MIDI – for more information read the page on the PJRC site.Download the USB MIDI controller code for Teensy v1.0
I have a different set of code for using the Teensy as a MIDI output device, which I’ll post at some point. Get in touch if you have any questions or if you run into any trouble.