Hi, after turning a 49 keys vintage keyboard (6x9 matrix) into a MIDI controller using arduino UNO, i need to transpose all notes for Fl studio, when I play the first note C I can here it playing a C but on FL keys I saw it playing C♯, all notes same problem it shifted to another note . Is it a coding problem ? What can do to transpose the notes by a semi tone?
#include <Keypad.h> // load library "Keypad".
#include <MIDI.h> // load library "MIDI Library".
MIDI_CREATE_DEFAULT_INSTANCE();
const byte ROWS = 6; //base 6 ROWS (Do,Fa#)(Do#,Sol)(Re,Sol#)(Re#,La)(Mi,La#)(Fa,Si)
const byte COLS = 9; //x 5 columns (Octave_1a)(Octave_1b)(Octave_2a)(Octave_2b)(Octave_3a)
byte keys[ROWS][COLS];
byte rowPins[ROWS] = {A0, A1, A2, A3, A4, A5}; //A0, A1, A2, A3, A4, A5
byte colPins[COLS] = {2, 3, 4, 5, 6, 7, 8, 9, 10,}; //One Pin for every 6 tones
byte pressed_key;
int note = 25;// initial note
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
String msg = "";
void setup() {
MIDI.begin(); //start transmission Midi.
Serial.begin(115200);
//fill matrix of keys with note values
for (int c=0; c<COLS; c++){
for (int r=0; r<ROWS; r++){
keys[r][c]=note;
note++;
}
}
}
void loop() {
//search for pressed keys (up to 10 at the same time)
if (kpd.getKeys())
{
for (int i=0; i<LIST_MAX; i++) // The entire Matrix is scanned.
{
if ( kpd.key[i].stateChanged ) // If a key changes state.
{
switch (kpd.key[i].kstate) { // Pressed or Released
case PRESSED:
msg = " PRESSED.";
pressed_key=kpd.key[i].kchar;
MIDI.sendNoteOn(pressed_key, 80, 1);
break;
case RELEASED:
msg = " RELEASED.";
pressed_key=kpd.key[i].kchar;
MIDI.sendNoteOff(pressed_key, 20, 1);
}
}
}
}
} // End loop
Piano_Midi.ino (1.7 KB)