Ableton MIDI Control with Arduino

September 22, 2024

Overview

In this project, I experimented with sending MIDI signals to Ableton using an Arduino board. The objective was to build a simple arpeggio generator that could control the synthesizer in real-time, adding dynamic, interactive sound control.


Development

I looked up these materials to help me set up the project


Demo


Key Code Snippets

void play_arp(int startNote) {
  int sustain = 50;
  int interval = 50;
  int inc = 0;

  for (int i = 1; i <= 4; i++) {
    if (i % 2 == 0) {
      inc += 4;
    } else {
      inc += 3;
    }

    Serial.println(inc);
    noteOn(0, startNote + inc, 64);
    delay(sustain);
    noteOff(0, startNote + inc, 64);
    delay(interval);
  }
}

int startNote = 60;
int playArp = 0;

void loop() {
  int buttonState = digitalRead(2);


  long newPosition = myEnc.read();
  if (newPosition != oldPosition) {
    startNote += (newPosition - oldPosition) / 4;
    oldPosition = newPosition;
    Serial.println(newPosition);
  }

  if (buttonState == HIGH) {
    stop_maj7(startNote);
  } else {
    Serial.println("Sending note on");
    play_arp(startNote);
  }
}