We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › proMIDI & "midi drawing"
Page Index Toggle Pages: 1
proMIDI & "midi drawing" (Read 440 times)
proMIDI & "midi drawing"
Nov 30th, 2007, 11:12am
 
Hello,

I'm using proMIDI lib.
works fine now.

I would like to use 2 controller values for drawing a shape.
I mean I'd like to use a value for x, another value for y.

I tested with the example code only modified for the draw function:
____________________________________
import promidi.*;

MidiIO midiIO;

void setup(){
 size(128*5,128*5);
 smooth();
 background(0);
 
 //get an instance of MidiIO
 midiIO = MidiIO.getInstance(this);
 println("printPorts of midiIO");
 
 //print a list of all available devices
 midiIO.printDevices();
 
 //open the first midi channel of the first device
 midiIO.openInput(0,0);
}

void draw(){
 background(120);
 fill(120,130);
 rect(0,0,width,height);
}

void noteOn(Note note, int device, int channel){
 int vel = note.getVelocity();
 int pit = note.getPitch();
 
 fill(255,vel*2,pit*2,vel*2);
 stroke(255,vel);
 ellipse(vel*5,pit*5,30,30);
}

void noteOff(Note note, int device, int channel){
 int pit = note.getPitch();
 
 fill(255,pit*2,pit*2,pit*2);
 stroke(255,pit);
 ellipse(pit*5,pit*5,30,30);
}

void controllerIn(Controller controller, int device, int channel){
 int num = controller.getNumber();
 int val = controller.getValue();
 
 fill(255,num*2,val*2,num*2);
 stroke(255,num);
 ellipse(num*5,val*5,30,30);
}

void programChange(ProgramChange programChange, int device, int channel){
 int num = programChange.getNumber();
 
 fill(255,num*2,num*2,num*2);
 stroke(255,num);
 ellipse(num*5,num*5,30,30);
}
____________________________________


How could I do it?
I may not use the controllerIn function as I should do.
Page Index Toggle Pages: 1