Sysex 0x02 MIDI_GET_PARAMETER

OK so almost got this working - but for some reason the most i can get the drive value to change to is 2.5 at full position on my volume pedal.
I have verified that 100% gives a MappedValue reading of 127.
Confused????
Any ideas pls?

Code:
            int MappedValue = map(CurrentPotValue, 0, 1023, 0, 127);  // Map the Pot analog reading value to range of 0-127

            float value = (MappedValue / 127.0);
            int new_value = (int) (value * 65534);
         
            byte First_byte = (new_value & 0x7F);
            byte Second_byte = ((new_value >>= 7) & 0x7F);
            byte Third_byte = ((new_value >>= 14) & 0x7F);
         
            byte TempXOR1 = (0xEF ^ First_byte);                 // where 0xEF = XOR's of 1st part of sysex bytes - 0xF0, 0x00, 0x01, 0x74, 0x03, 0x02, 0x6A, 0x00, 0x01, 0x00.
            byte TempXOR2 = (TempXOR1 ^ Second_byte);
            byte TempXOR3 = (TempXOR2 ^ Third_byte);
            byte TempXOR4 = (TempXOR3 ^ 0x01);
            byte CheckSum = (TempXOR4 & 0x7F);

            byte Amp1_Drive_sysex[16] = {0xF0, 0x00, 0x01, 0x74, 0x03, 0x02, 0x6A, 0x00, 0x01, 0x00, First_byte, Second_byte, Third_byte, 0x01,  CheckSum, 0xF7};
            MIDI.sendSysEx(16, Amp1_Drive_sysex, true);
 
Last edited:
Found the issue.
It was with these 2 lines
Code:
byte Second_byte = ((new_value >>= 7) & 0x7F);
byte Third_byte = ((new_value >>= 14) & 0x7F);

..which I used based on Nero's earlier comment:
parameter value goes from 0 to 65534 which is split into three 7-bit bytes, to conver a number ranging from 0 to 65534 into 3 bytes

first byte
(value & 0x7F);

second byte
((value >>= 7) & 0x7F);

third byte
((value >>= 14) & 0x7F);

I changed the ">>=" to just ">>" and appears to now work correctly.

As I said earlier not too clued up on this bit manipluation stuff - so if any one could offer an explanation I'd really appreciate it pls.
Thanks
 
Tidied up my code for calc'ing the checksum from:

Code:
byte TempXOR1 = (0xEF ^ First_byte);                 // where 0xEF = XOR's of 1st part of sysex bytes - 0xF0, 0x00, 0x01, 0x74, 0x03, 0x02, 0x6A, 0x00, 0x01, 0x00.
byte TempXOR2 = (TempXOR1 ^ Second_byte);
byte TempXOR3 = (TempXOR2 ^ Third_byte);
byte TempXOR4 = (TempXOR3 ^ 0x01);
byte CheckSum = (TempXOR4 & 0x7F);
byte Amp1_Drive_sysex[16] = {0xF0, 0x00, 0x01, 0x74, 0x03, 0x02, 0x6A, 0x00, 0x01, 0x00, First_byte, Second_byte, Third_byte, 0x01,  CheckSum, 0xF7};
to
Code:
byte Amp1_Drive_sysex_1st_chunk = (0xF0 ^ 0x00 ^ 0x01 ^ 0x74 ^ 0x03 ^ 0x02 ^ 0x6A ^ 0x00 ^ 0x01 ^ 0x00);
byte CheckSum = ((Amp1_Drive_sysex_1st_chunk ^ First_byte ^ Second_byte ^ Third_byte ^ 0x01) & 0x7F);

Works great for Amp 1 Drive (ie Parameter ID bytes - 0x01, 0x00).
But if I change to a different ID - say Amp1 Bass - which is Parameter ID bytes 0x02, 0x00 - I get a sysex error & the parameter value does not update.
Code:
byte Amp1_Drive_sysex_1st_chunk = (0xF0 ^ 0x00 ^ 0x01 ^ 0x74 ^ 0x03 ^ 0x02 ^ 0x6A ^ 0x00 ^ 0x02 ^ 0x00);

Where am I going wrong here pls?
 
Wow - how stupid can I be.. :)

Sussed it..eventaully.
I was only changing the Parameter ID to 0x02 in the code for the Checksum calculation.
I also needed to change it in the final sysex array that I actually send to the AxeFX.

Code:
byte Amp1_Drive_sysex[16] = {0xF0, 0x00, 0x01, 0x74, 0x03, 0x02, 0x6A, 0x00, 0x02, 0x00, First_byte, Second_byte, Third_byte, 0x01,  CheckSum, 0xF7};
MIDI.sendSysEx(16, Amp1_Drive_sysex, true);

Doh!!!!!!!!!!!!!!!
 
For anyone interested - here's my block of code for changing AMP 1 controls via a volume pedal (Exp P-2) connected to an analog pin on my controller.

Code:
{
        const int POT_THRESHOLD = 10;                                               // Threshold amount - so can reject values too close to the last known good value
        analogReadAveraging(32);                                                           // controls automatic averaging done in the ADC. The max is 32,
        int CurrentPotValue = analogRead(ExpPed2_AnPin);                     // Read the value of Analog Pin 9 (Should have a range of 0 - 1023)

        int MappedValue = map(CurrentPotValue, 0, 1023, 0, 127);             // Map the Pot analog reading value to range of 0-127
        MappedValue = constrain (MappedValue, 0, 127);                          // Constrains/restricts value to be within a range of 0-127 to allow for pot travel beyond its limits
        int temp = CurrentPotValue - PrevioustPotValue;
        if(abs(CurrentPotValue - PrevioustPotValue) < POT_THRESHOLD)    // Takes Modulus of (Current - Previous) Pot readings & compares to Threshold value
        {
            //do nothing - ie  the rest of subsequent code is not run.
        }
        else
        {
            PrevioustPotValue = CurrentPotValue;

            float value = (MappedValue / 127.0);                      //Calc the current pot position as a fraction of full travel (0 = 0, 127 = 1)
            long new_value = (long) (value * 65534);                //Convert to proportion of range (ie 0-65534) & convert from float to type long. 
            
            // Calculate the 3 "Parameter Value"  bytes for sysex msg.
                byte First_byte = (new_value & 0x7F);
                byte Second_byte = ((new_value >> 7) & 0x7F);
                byte Third_byte = ((new_value >> 14) & 0x7F);

            //Change these for required "Parameter ID's" (0x1 = Amp Drive, 0x2 = Amp Bass ect)
               byte Param_ID_byte1 = 0x02;
               byte Param_ID_byte2 = 0x00;
       
            //Calc Checksum
               byte Amp1_Drive_sysex_1st_chunk = (0xF0 ^ 0x00 ^ 0x01 ^ 0x74 ^ 0x03 ^ 0x02 ^ 0x6A ^ 0x00 ^ Param_ID_byte1 ^ Param_ID_byte2);
               byte CheckSum = ((Amp1_Drive_sysex_1st_chunk ^ First_byte ^ Second_byte ^ Third_byte ^ 0x01) & 0x7F);
           
            //Build sysex msg array 
               byte Amp1_Drive_sysex[16] = {0xF0, 0x00, 0x01, 0x74, 0x03, 0x02, 0x6A, 0x00, Param_ID_byte1, Param_ID_byte2, First_byte, Second_byte, Third_byte, 0x01,  CheckSum, 0xF7};
            //Send sysex msg
               MIDI.sendSysEx(16, Amp1_Drive_sysex, true);
        }
    }
 
Hi - does anyone know if literally every parameter for every Block gets a "Parameter ID" assigned.?

If so - are they listed anywhere.
All I can find is old listings for the Ultra & the Standard
 
each block has a set of parameters, each parameter per block has a unique id ranging from 0 whatever the blocks parameter count is. they aren't documented you need a midi monitor to explore them, the same parameter may have a different label on the editor and not all effect types may share the same parameters, for example a jumped plexi will have the overdrive parameter which is not use on a jcm800 and so on, you can still edit it but it will do nothing
 
ok cool thanks.

So are you saying for eg - the Amp Bright parameter ID will or will not be teh same across ALL amps (if it is actually present in each amp that is ofcourse)?

Not had much joy with midi OX over usb in the past so will just have to resort to trying 1 by one for now.
Trying to find the ID for the BRIGHT knob on teh pre-Amp page.
 
no, the bright parameter id will always be the same across all amps, when you go into other blocks it's when things start to get complex.

Drive = 1;
OverDrive = 74;
Bass = 2;
Mid = 3;
Treble = 4;
Bright = 97;
Presence = 20;
Depth = 16;
Master = 5;
 
Hi Nero - thanks for all your help so far - it's much appreciated.

I now have Amp 1, Dly 1 & Cho 1 working as desired.
But I'm now having trouble with the Drive 1 block.

I'm using 0x85, 0x00 for the effect ID bytes - is that correct or am I missing a trick here?
0xF0 sysex start
0x00 Manf. ID byte0
0x01 Manf. ID byte1
0x74 Manf. ID byte2
0x03 Model #
0x02 Function ID (2)
0xdd effect ID bits 6-0
0xdd effect ID bits 13-7
0xdd parameter ID bits 6-0
0xdd parameter ID bits 13-7
0xdd parameter value bits 6-0
0xdd parameter value bits 13-7
0xdd parameter value bits 15-14
0x00 0=query value, 1=set value
0xdd checksum
0xF7 sysex end
 
MIDI sysex only deals with 7bit bytes, the highest number a byte can be (other than the 0xF0 and 0xF7) is 0x7F or 127 in decimal, the id of drive1 is 133 so you have to convert that number into 2 bytes and those 2 bytes are the bytes that will be sent under "effect ID bits" same goes for the parameter id

you should always handle the effect id, parameter id and parameter value as integers and then convert them into midi bytes before sending them otherwise you'll have to hard code each parameter for each block that you want to send.

to get the block id and parameter bytes:
int value = 133;
byte1 = value & 0x7F;
byte2 = (value >> 7) & 0x7F;

so for drive 1 the bytes will be 0x05 and 0x01, (128*byte2)+byte1 = (128*1)+5 = 133

to get the bytes you could also do something like this

int value = 133
byte byte2 = value/128;
byte byte1 = value-(128*byte2);

my C++ is rusty so take it all with a grain of salt
 
Cool thread. I'm a programmer, so I'm following the tech aspect...I'm just curious why? What are you trying to accomplish?
 
Hi rocket.

I started a project some time ago to build myself a midi foot controller for my axefx2.
Initially I just wanted to change presets (up and down) away from the afx.

But i got bitten by the coding bug and I'm now on my 4th version.
Started with a Teensy 3 MCU.
Now using the Teensy 3.6 and mfc has:
Midi in and out,
24 switches,
20 LEDs
1 TFT display
8 x 8x2 LCD displays
A second expression pedal input.

Anyway i digress - to answer your question, the purpose is to be able to "tweak" effect block parameters remote from the axefx.
Initially I just wanted to do this for the amp basic parameters ie drive, bass, mid, treble, bright, present & output level.

But now moving on to include other commonly used effects ie Drive, delay, chorus.

Ive only been able to get this far with the kind help of people like Nero and others on this and the the pjrc forums.
 
Last edited:
Hi rocket.

I started a project some time ago to build myself a midi foot controller for my axefx2.
Initially I just wanted to change presets (up and down) away from the afx.

But i got bitten by the coding bug and I'm now on my 4th version.
Started with a Teensy 3 MCU.
Now using the Teensy 3.6 and mfc has:
Midi in and out,
24 switches,
20 LEDs
1 TFT display
8 x 8x2 LCD displays
A second expression pedal input.

Anyway i digress - to answer your question, the purpose is to be able to "tweak" effect block parameters remote from the axefx.
Initially I just wanted to do this for the amp basic parameters ie drive, bass, mid, treble, bright, present & output level.

But now moving on to include other commonly used effects ie Drive, delay, chorus.

Ive only been able to get this far with the kind help of people like Nero and others on this and the the pjrc forums.

Do you have any pictures of your project?

I hope to someday find the time to re-learn how to program, so I can make my own MFC.
 
I do - but I've I can't see how I attach them in this forum.
If I click "IMAGE " icon above it only asks for a URL not a drive path & name.
 
it's pretty nice to know someone else had this idea. i mean to make a bunch of max/msp patches to use with my ax8, one of which was to turn a desktop midi controller into a knob box to control various amp/effect things. this seems like a great step in the right direction...
 
Back
Top Bottom