MidiMapper is a processing library that allows to maps midi devices and their events to members of a sketch such as variables and functions. Currently this library is in development stage.
Connect to a midi device and assign a note to a variable. Controller changes will be automatically applied to the value of the variable.
import sojamo.midimapper.*;
MidiMapper midi;
float a;
void setup() {
midi = new MidiMapper(this);
/* SLIDER/KNOB is the name of the Korg nanoKontrol2 device as detected on osx */
midi.connect("SLIDER/KNOB").assign(16).to("a");
}
void draw() {
background(0);
fill(255);
translate(width/2, height/2);
rotate(map(a, 0, 127, -PI, PI));
translate(-20, -20);
rect(0, 0, 40, 40);
}
18 February 2015