MIDI out
in
Contributed Library Questions
•
1 year ago
I'm using Midibus at the moment.
Ideally what I want is for MIDIout to be only sent once every time that mouseX enters the parameters of width/2 and to be sent as one continuos note until x>width/2.
My problem is that when x<width/2 the MIDIout message is constantly repeated depending on frameRate or on the delay I set.
How do I only make it sound once, and every time the mouse enters the <width/2 parameter?
I hope I have explained this clearly. I don't know if this is a specific MIDI issue or maybe I'm just not thinking of code implementation properly.
Thank you.
import themidibus.*;
MidiBus myBus;
void setup() {
size(200,200);
background(0);
myBus = new MidiBus(this, "", "Java Sound Synthesizer");
}
void draw() {
int aChannel, bChannel ;
int aPitch, bPitch;
int aVelocity, bVelocity;
if (mouseX<width/2){
aChannel = 1;
aPitch = 60;
aVelocity = 127;
myBus.sendNoteOn(aChannel, aPitch, aVelocity);
delay(1000);
myBus.sendNoteOff(aChannel, aPitch, aVelocity);
}}
1