MidiFoot


This project was inspired by the idea of an acoustic wooden stomp-box, which is often equipped with a microphone or acoustic pick-up. The MidiFoot sends a variety of MIDI messages on channel 15 when the pedal is pressed or released, from single note on/off, to a pattern of notes, to repeated or toggled control change messages. Any or all of these messages could be routed to different notes or functions in a sound module or DAW, allowing the MidiFoot to do everything from play loops to act as a simple sustain pedal.

The heavy lifting is performed by the Teensy LC, which runs the code and emulates a USB MIDI device to anything you plug it into. While I may at some point design a custom pedal enclosure/mechanism, most keyboard sustain pedals are so simple it’s no real sacrifice to purchase one and tear it open to fit the necessary components inside. Pedals with a spring loaded or “clicky” contact seem to work better, as simple contact footswitches often produce failed or excessively bouncy contacts, giving missed or multiple triggers of notes/messages.

  1. Connect the footswitch to pin 20 and ground of the Teensy
  2. Cut the “B” end off a USB A-B cable, strip the ends of the loose wires and solder them to the matching Vcc, ground, data+ and data- pads on the underside of the Teensy.
  3. Install the Teensyduino software into your Arduino IDE. In the Tools menu of Arduino, set the USB type to “MIDI” and flash the code below onto the Teensy.
/*
 *  one foot MIDI controller
 *  sends a bunch of different messages when you press or release the footswitch
 *  map the messages to various things in your DAW to do .. various things
 */

#include 

const int channel = 15; // the MIDI channel number to send messages
bool flip1 = false;
int step4=0;
int step6=0;
int step16=0;

Bounce footSwitch = Bounce(20, 25); // 25ms bounce

void setup() {
  pinMode(20, INPUT_PULLUP);
}

void loop() {
  footSwitch.update();
  if (footSwitch.fallingEdge()) {
    usbMIDI.sendNoteOn(36, 99, channel); // bass drum 1
    usbMIDI.sendNoteOff(38, 0, channel); // bass drum 1
    usbMIDI.sendNoteOn(40+step4, 99, channel);
    usbMIDI.sendNoteOff(45+step4, 0, channel);
    usbMIDI.sendNoteOn(50+step6, 99, channel);
    usbMIDI.sendNoteOn(60+step16, 99, channel);
    flip1 = !flip1;
    usbMIDI.sendControlChange(12, 127*flip1, channel);
    usbMIDI.sendControlChange(13, 127, channel);
  }
  if (footSwitch.risingEdge()) {
    usbMIDI.sendNoteOff(36, 0, channel);
    usbMIDI.sendNoteOn(38, 99, channel); // bass drum 1
    usbMIDI.sendNoteOff(40+step4, 0, channel);
    usbMIDI.sendNoteOn(45+step4, 99, channel);
    usbMIDI.sendNoteOff(50+step6, 0, channel);
    usbMIDI.sendNoteOff(60+step16, 0, channel);
    if (++step4==4) step4=0;
    if (++step6==6) step6=0;
    if (++step16==16) step16=0;
    usbMIDI.sendControlChange(13, 0, channel);
  }
  while (usbMIDI.read()) {
    // ignore incoming messages
  }
}