Visits

Monday, February 26, 2018

Tap Tempo Ableton & Arduino

After frustrations of trying to keep time, I've finally cracked my main problem.
How, as a guitarist with almost no knowledge of music theory can I get the tempo that feels right without having a band?

Dead simple really and very very cheap.

I came up with the idea a few years ago when still studying accounting and addicted to Kerbal Space Program.

You see I decided to use an Arduino to make a flight controller for that wonderful game. And I did. To a point.

The prototype was coming along nicely and I'd fabricated the chassis, and worked out the code for the various meters, dials, switches etc... but then exams loomed large and it looked like I might not finish if I continued.

So all that stuff was shelved. But not forgotten.

Now it's been a long while since I picked up the old soldering iron, but I've long had this desire to add tap-tempo to my DAW setup.

Ableton makes it easy from a keyboard (not the musical kind).
Not so much for my midi hardware, which refuses to send midi data from the damper pedal for the thing that I desire.

This is where I decided (about 2 years ago) to re-purpose my arduino to enable tap tempo. Then I sat on the idea, because in my shed is a vortex of chaos and I couldn't find the Arduino board, or kept finding other things to do.

The code bit is easy. The barest modification of the Keyboard Write function.

All I did was figure out what the ASCII key number was for ` and then replace A in the example.

I then tapped two bits of wire together, and just like that tap tempo was at hand!
Later by foot.

Here's the code:

#include <Keyboard.h>

void setup() {
  // make pin 2 an input and turn on the
  // pullup resistor so it goes high unless
  // connected to ground:
  pinMode(2, INPUT_PULLUP);
  Keyboard.begin();
}

void loop() {
  //if the button is pressed
  if(digitalRead(2)==LOW){
    //Send an ASCII '`',
    Keyboard.write(39);
  }
}

No comments:

Post a Comment