Pages: [1]   Go Down
Author Topic: Reading series of MIDI SysEx messages Help Please!  (Read 747 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you post your code you have sofar?
Logged

Rob Tillaart

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:


#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...
« Last Edit: July 20, 2011, 12:59:48 pm by Evz » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
#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...



}

Logged

Pages: [1]   Go Up
Jump to: