Is it possibile to sync Processing's frameRate/draw function with and incoming MIDI signal?

Hi everyone, today I had this idea and tried to write some code but then got stucked.

I'm thinking about syncing Processing's frameRate/draw function with an incoming MIDI signal because I would love to create a visualization in sync with music coming from Ableton.

With the MidiBus Library and through the IAC Driver on my Mac I got the Sync/Clock MIDI Message from Ableton into Processing but then I wasn't able to link those two things together.

This is my code so far but I'm not sure it's working properly. Any help would be greatly appreciated.

import themidibus.*; //Import the library
import javax.sound.midi.MidiMessage; //Import the MidiMessage classes
import javax.sound.midi.SysexMessage;
import javax.sound.midi.ShortMessage;

MidiBus myBus; // The MidiBus

int i = 1;

void setup() {
  size(400, 400);
  myBus = new MidiBus(this, 0, 1);

void draw() {
 if(frameCount % 60 == 0) {
   i = 1;

void midiMessage(MidiMessage message) {
  print(i + " ");


Sign In or Register to comment.