Midi device does not response correctly with SysEx #279
-
HI, i had sysex to send and everything works when directly send via midiox, but not with arduino -> midiox -> midi device, sometimes my midi device does not respons correctly or some sysex not sent/corrupted. I planed using arduino pro mini 3.3v 8mhz battery powered using 5pin midi din and may storing data in PROGMEM, but in this case i used promicro 5v for trial project. So every key press i have sending at least 7 different sysex. Can someone help me with my code ? #include "MatrixKeypad.h"
#include <stdint.h>
#include <USB-MIDI.h>
USBMIDI_CREATE_DEFAULT_INSTANCE();
//byte 10th sound category
//byte 12th on/off switching value
//byte 16th bank sound (A-D)
//byte 17th sound number and on/off state
//sound
uint8_t StartSysEx1 [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x38, 0xF7}; //my piano
uint8_t StartSysEx16 [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3C, 0xF7}; //slow string
//on switch
uint8_t StartSysEx_1on [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x02, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF7}; //1
uint8_t StartSysEx_2on [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x03, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF7};
uint8_t StartSysEx_3on [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x04, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF7};
uint8_t StartSysEx_4on [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x05, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF7};
uint8_t StartSysEx_5on [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x06, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF7};
uint8_t StartSysEx_6on [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x07, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF7};
//off switch
uint8_t StartSysEx_1off [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x02, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7}; //1
uint8_t StartSysEx_2off [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x03, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7};
uint8_t StartSysEx_3off [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x04, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7};
uint8_t StartSysEx_4off [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x05, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7};
uint8_t StartSysEx_5off [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x06, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7};
uint8_t StartSysEx_6off [] = {0xF0, 0x42, 0x30, 0x00, 0x01, 0x0C, 0x41, 0x00, 0x00, 0x07, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7};
const uint8_t rown = 4; //4 rows
const uint8_t coln = 4; //3 columns
uint8_t rowPins[rown] = {15, 10, 16, 14}; //frist row is connect to pin 10, second to 9...
uint8_t colPins[coln] = {5, 8, 7, 6}; //frist column is connect to pin 6, second to 5...
char keymap[rown][coln] =
{{'A','B','C','D'},
{'E','F','G','H'},
{'I','J','K','L'},
{'M','N','O','P'}};
MatrixKeypad_t *keypad; //keypad is the variable that you will need to pass to the other functions
char key;
void setup() {
MIDI.begin();
keypad = MatrixKeypad_create((char*)keymap /* don't forget to do this cast */, rowPins, colPins, rown, coln); //creates the keypad object
}
void loop() {
MatrixKeypad_scan(keypad); //scans for a key press event
if(MatrixKeypad_hasKey(keypad)){ //if a key was pressed
key = MatrixKeypad_getKey(keypad); //get the key
switch (key) {
case 'A':
MIDI.sendSysEx(sizeof(StartSysEx1),StartSysEx1, true);
MIDI.sendSysEx(sizeof(StartSysEx16),StartSysEx16, true);
MIDI.sendSysEx(sizeof(StartSysEx_1on),StartSysEx_1on, true);
MIDI.sendSysEx(sizeof(StartSysEx_2off),StartSysEx_2off, true);
MIDI.sendSysEx(sizeof(StartSysEx_3off),StartSysEx_3off, true);
MIDI.sendSysEx(sizeof(StartSysEx_4off),StartSysEx_4off, true);
MIDI.sendSysEx(sizeof(StartSysEx_5off),StartSysEx_5off, true);
MIDI.sendSysEx(sizeof(StartSysEx_6on),StartSysEx_6on, true);
break;
case 'B':
break;
case 'C': //and so on
}
delay(500);
}
}
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Sorry, i just checked some of my sysex has wrong value . now everything works. |
Beta Was this translation helpful? Give feedback.
Sorry, i just checked some of my sysex has wrong value . now everything works.