Hello,
I am trying to use a MIDI keyboard to create a red ellipse to start with. I keep getting the same response of cannot convert void to boolean. Any help would be appreciated.
import themidibus.*;
MidiBus myBus;
int x;
void noteOn(int channel, int pitch, int velocity) {
}
void setup () {
size (400, 400);
background (0);
MidiBus.list();
myBus = new MidiBus(this, 0, 3);
}
void draw () {
while (noteOn (0, 60, x));{
fill (255, 0, 0);
ellipse (200, 200, 200, 200);
}
}
noteOn() is a method which is called when a Note On midi signal reaches your sketch. So you are able to write code in that function to do something. The parameters are then set to the specific channel and pitch. To just log which note was pressed, you can add a simple println().
Now to use this information later in the draw method, you need to store the information you get in noteOn. You could just use a simple boolean to indicate if the note was pressed or not.