So after a frustrating day i feel i have made some headway on my project.
I have a button triggering a pin on my arduino board along with code to blink the on board led when it is pressed and released. this is working i see the led blinking.. on and off.
this is the pin out for my style of midi.
Here is the if statement that initiates the button press.
if (debouncedState == HIGH) {
digitalWrite(13, 1 );
CMDToChange = 128;
PadToChange = pn;
StateToChange = 1;
buttonClicked('22');
Serial.println("pressed");
} else {
digitalWrite(13, 0 );
CMDToChange = 144;
PadToChange = pn;
StateToChange = 1;
buttonClicked('22');
Serial.println("released");
}
Here are more variables that i would like to include to later on effect aftertouch and things of that nature within the midi message. right now Im trying to focus on getting a single note through first. The values are generic as they are always changing as the midi interface is used.
int PinToChange;
int StateToChange;
int PadToChange;
char PadValue;
long CMDToChange = 144;
int CMDValue = 1;
int NoteToChange = 50;
int NoteValue = 1;
int VelToChange;
int VelValue = 1;
char TrackToChange;
int TrackValue = 1;
char BarsToChange;
int BarsValue = 1;
char LengthToChange;
int LengthValue = 1;
char ActBarToChange;
int ActBarValue = 1;
char BankToChange;
int BankValue = 1;
basically when it comes down to these lines something is amiss.
void changeAllStates() {
noteOn( CMDToChange, NoteToChange, VelToChange);
}
void noteOn(int cmd, int pitch, int velocity) {
//Serial.print(cmd);
mySerial.write(cmd);
mySerial.write(pitch);
mySerial.write(velocity);
Serial.write(cmd);
Serial.write(pitch);
Serial.write(velocity);
}
As you can see I have a few variables that define which type of is to be sent.
CMDToChange will be 144 - 159 to equal a NOTE ON message
or 128-143 for a NOT OFF message
While researching midi messages I came across something that looks as thought it may be useful. Pretty much explains what the numbers mean and a bit more.
http://computermusicresource.com/MIDI.Commands.html
I am having trouble sending the correct midi message to my synth.
can anyone help me out with the correct way to send midi messages?
One Last thing when i play a note on my synth and then while it is still going i would then press the momentary button that is pinned to my arduino and it will Stop whatever is ringing through the synth.