Thursday, December 06, 2018

Teensy 3.6 as Standalone Mediator Between USB MIDI and Eurorack

USB MIDI controllers (such as Launchpad Mini Mk II for example) are common and often quite low in cost.

To interface such a controller with a Eurorack synth system, often a host computer and a MIDI to CV interface might be used. The host computer would take USB MIDI data from the MIDI controller, perhaps store and manipulate that data in some way (e.g. a sequence), using a MIDI to CV converter to then control a Eurorack synth system.

It would be useful to use USB MIDI controllers with Eurorack synth systems without needing a computer and MIDI to CV interface in between the two.

Teensy 3.6 is a great microcontroller that can be programmed using the Arduino IDE. A very useful feature of the Teensy 3.6 is the USB host port.

Using the USB host port, the Teensy 3.6 can act as a host device for a USB MIDI controller. This means that a computer is not required to interpret the USB MIDI messages from a USB MIDI controller.

The Teensy can receive MIDI data sent over USB from the MIDI controller (e.g. faders, knobs, buttons) and can also send MIDI data back to the MIDI controller over USB (e.g. LEDs for buttons, displays).

At the same time, the Teensy can send and receive voltages to and from a Eurorack system. This includes control voltages, gates, triggers and clock signals as both inputs and outputs.

By programming the Teensy, a relationship between USB MIDI data from the controller and the voltages to and from a Eurorack system can be set up.

Example - Launchpad Mini Mk II as Eurorack Sequencer
In this example, the Launchpad and Teensy are working together as a simple Eurorack gate sequencer. This example can be built on extensively, but serves to illustrate the point of USB MIDI host mediation.

Hardware Setup
The USB host port on the Teensy 3.6 needs to have header pins soldered for accessibility, so that the header pins stick up out of the Teensy.

A USB host cable is connected between the USB host post on the Teensy and a USB MIDI device, in this case a Launchpad Mini Mk II.

The desired input and output connections are then connected to the Teensy. In this simple example, the Teensy will provide six gate outputs via six Eurorack-style 3.5mm sockets.

Teensy 3.6 digital pins 0 - 5 are connected via 1k resistors to the signal connection of the 3.5mm sockets. Teensy 3.6 ground is connected to the ground connection of the 3.5mm sockets.

If more complexity was required, additional outputs, inputs, buttons and pots could be connected to the Teensy to extend this example beyond the six gates.

The six gate outputs are connected to gate inputs in a Eurorack system, which in the demo video is triggering some Erica Synths, Make Noise and Doepfer modules.

Software Setup
The Arduino code can be downloaded here. The Teensyduino extension should be installed, the board should be set to Teensy 3.6 and the USB mode to Serial. The code is not very concise, but is hopefully easy enough to read.

The code takes button inputs from the Launchpad Mini Mk II grid and stores these button presses in an array which holds the pattern. The Teensy also controls the LED lights on the Launchpad, and has an indicator as to which step is currently playing.

Each row represents a trigger output. Each column represents a step.

Pressing a button in the grid once will make sure it plays each loop of eight steps. Pressing a button a second time will play that gate every odd loop. Pressing a button a third time will play that gate every even loop. Pressing a button a fourth time will turn that stop off completely.

The const int interval_time, which defaults to 90, sets the speed of the sequencer.

Obviously, this simple example can be greatly expanded on. The next step in this project is to build a generic PCB with perhaps 8 gate outputs, 4 CV outputs, 4 gate inputs, and two buttons and two pots, and then start writing code to adapt a number of USB MIDI controllers to Eurorack.