bossredman
Inspired
doh - pls ignore me - you already did this earlier - right!
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);
byte Second_byte = ((new_value >>= 7) & 0x7F);
byte Third_byte = ((new_value >>= 14) & 0x7F);
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);
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};
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);
byte Amp1_Drive_sysex_1st_chunk = (0xF0 ^ 0x00 ^ 0x01 ^ 0x74 ^ 0x03 ^ 0x02 ^ 0x6A ^ 0x00 ^ 0x02 ^ 0x00);
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);
{
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 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.