Go Down

Topic: Reading series of MIDI SysEx messages Help Please! (Read 855 times) previous topic - next topic

Evz

Hello there!

I've been somewhat challenged to integrate reading a set of midi sysex messages into my program, but unfortunately my midi.read skill are not good as my midi.send skills.
The problem:
I have a piece of hardware (AXEFX) which when in tuner mode sends out the following batches of Midi messages:

0xF0 sysex start
0x00 Manf. ID byte0
0x00 Manf. ID byte1
0x7d Manf. ID byte2 (this value is configurable within the Axe-Fx)
0xdd Model #
0x0d Calling Function ID
0x?? Note value (0 = A, 1 = A#, 2 = B, 3 = C etc)
0x?? Note octave
0x?? Fine tune (0 = very flat, 0x7f - very sharp, 0x3f/0x40? - in tune)
0xF7 sysex end


In my current program, i have an external program which is called when the tuner function is enabled, and i want to be able to read these 10 sysex messages and analyze them as they are sent..
The point in the loop is to read the 10 messages, temporarily store them, so if 0xf0 , store the next 8 messages until 0xf7, then set message #6 as note and message #9 as tune.

would anyone be able to help me out with this?

I plan on prototyping this out with just a midi in reader + LCD screen...

Thanks!

robtillaart

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Evz

#2
Jul 20, 2011, 07:24 pm Last Edit: Jul 20, 2011, 07:59 pm by Evz Reason: 1
this is the smaller program i plan on running just with midi in and LCD using midi shield and midi library v2.9 i believe... (code is missing set ups but the idea is there i think)


Code: [Select]


#include <MIDI.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 2, 3, 4, 5);

void setup(){
MIDI.begin();
}


void loop(){
byte* SysExA;
int note=0;
int tune=0;
MIDI.read();
delay(100);
lcd.clear(); // should clear and reset lcd ever iteration
SysExA = MIDI.getSysExArray();
        note = SysExA(6);
        tune = SysExA(8);


}


but my issue is that MIDI.getSysExArray is byte* type, but i want to get an array out of it and nothing i do compatible...

Evz

I think this is a better code... (i've refreshed my memory of pointers ;))

Code: [Select]
#include <MIDI.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 2, 3, 4, 5);

void setup(){
MIDI.begin();
}


void loop(){

int note=0;
int tune=0;
MIDI.read();          //read the midi
        MIDI.getSysExArray();  //store the sysex message as an array (this is array pointer)
        int sizear = MIDI.getData1();
delay(100);
        /*
byte SysExA[sizear];
lcd.clear();
        for(int i=0;i<sizear;i++){    //MUST GET SIZE OF ARRAY FIRST!
SysExA[i] = (MIDI.getSysExArray())[i]; //not necessary
        }*/
       
        byte * SysExA = MIDI.getSysExArray(); //just make another pointer instead of array
        tune = SysExA[6];
       
//MIDI.getSysExArray is acually a pointer, need to use '*' qualifier to see whats inside...



}


Go Up