Hi all! Having some trouble...
trying to make a midi controller out of a guitar hero guitar. i think i have the wires and everything mpped out correctly. when plugged into the synth, the notes sometimes play and when they do they continue to play for a bit after they arent pressed anymore.. and the 'octave' buttons seems to only change the sounds option on the synth, or reset it and short it somehow. im uing a microkorg to test it.
is it my code? my wiring? im at a loss.
the resitors are 10k for the inputs, and a 220 powering the midi out
//ocatva change inputs
const int octD = 6;
const int octU = 5;
//fret button inputs;
const int uno = 7; //
const int dos = 8;
const int tre = 9;
const int qua = 10;
const int cin = 11;
//midi note velocity
int noteVelocity = 127;
//set ints for button on off states
int unoOn = 0;
int dosOn = 0;
int treOn = 0;
int quaOn = 0;
int cinOn = 0;
int octUon = 0;
int octDon = 0;
//aOn to add and subtract 12s from midinotes for octve shift
int aOct = 0;
void setup()
{
pinMode( uno, INPUT ); // inputmodes for all buttons
pinMode( dos, INPUT );
pinMode( tre, INPUT );
pinMode( qua, INPUT );
pinMode( cin, INPUT );
pinMode( octU, INPUT );
pinMode( octD, INPUT );
Serial.begin(31250);//midi baud
delay(1000);
}
void loop()
{
unoOn = digitalRead(uno);//read pin states
dosOn = digitalRead(dos);
treOn = digitalRead(tre);
quaOn = digitalRead(qua);
cinOn = digitalRead(cin);
octUon = digitalRead(octU);
octDon = digitalRead(octD);
if (unoOn == HIGH) { //button activates in note on i usually see 0x90, but have seen 0x91 too
noteOn( 0x91, 55+aOct, noteVelocity);
} else {
noteOn( 0x91, 55+aOct, 0);
}
if (dosOn == HIGH) {
noteOn( 0x91, 57+aOct, noteVelocity);
} else {
noteOn( 0x91, 57+aOct, 0);
}
if (treOn == HIGH) {
noteOn( 0x91, 60+aOct, noteVelocity);
} else {
noteOn( 0x91, 60+aOct, 0);
}
if (quaOn == HIGH) {
noteOn( 0x91, 62+aOct, noteVelocity);
} else {
noteOn( 0x91, 62+aOct, 0);
}
if (unoOn == HIGH) {
noteOn( 0x91, 64+aOct, noteVelocity);
} else {
noteOn(0x91, 64+aOct, 0);
}
if (octUon == HIGH) {
aOct = aOct+12;
}
if (octDon == HIGH) {
aOct = aOct -12;
}
}
void noteOn(int cmd, int pitch, int velocity) { //midi out
Serial.write(cmd);
Serial.write(pitch);
Serial.write(velocity);
}