Saturday 2 April 2011

MIDI Trigger


This box translates footswitch inputs to MIDI note on/off messages. We're using this to trigger a sampler with some special Zaardy noises on. It has three banks of three notes. The notes are played using the three footswitches on the left. The bank is selected using either the red button on top of the box or the single footswitch on the right.

It's based on an Arduino Uno, a microcontroller with handy digital inputs for the footswitches and serial out for MIDI.

The electronics is straightforward - mostly LEDs, resistors, connectors and wires:


The Veroboard sits on top of the Arduino but has to be in two parts because the pin spacing is non-standard.



Plastic boxes are not very robust for live use, but they're much easier to make holes in than metal:


Assembled:


The LEDs are power (red), triggered (green), bank (yellow).

Software

To make the Arduino read the footswitch states and send the appropriate MIDI messages requires some bespoke software. The Arduino comes with a framework to help with this, so that all you have to do to read a digital input (footswitch) is:

state = digitalRead(pin);

...and state will be either HIGH or LOW.

Playing MIDI notes is also easy:

Serial.print(0x90 | (channel-1), BYTE);
Serial.print(note, BYTE);
Serial.print(velocity, BYTE);

To put this together into a complete application takes quite a lot more code, and this is what I ended up with:


The .h & .cpp files on the left are C++ classes, each performing some discrete function. They all get put together in the code on the right. The final application is downloaded to the Arduino through USB.


Future developments - Three notes are OK, but what we really need is thirteen:


This is the next project...

1 comment:

  1. Hi, just wondering if you are working on your 13 pedal project. I would love to see any progress. Please visit midipedals.com and share your expertise. Thanks, Terry

    ReplyDelete