Home › Forums › General › Programming › sysex message with funky checksum
- This topic has 8 replies, 3 voices, and was last updated 8 years, 11 months ago by memorysplice.
-
AuthorPosts
-
August 20, 2011 at 9:43 pm #419
I’m coding up some buttons on a jp-8080 panel..
some of roland’s sysex messages are weird.arpeggiator active, for instance sends
[f0 41 10 00 06 12 01 00 00 17 [b:6rzirppp]01 67[/b:6rzirppp] f7] for on state and
[f0 41 10 00 06 12 01 00 00 17 [b:6rzirppp]00 68[/b:6rzirppp] f7] for off stateThere are two variables – the 11th and 12th positions.
how do i set up the Button values to send 01,67 on one click then 00,68 on the next?
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
August 20, 2011 at 10:38 pm #3144duh that’s the checksum.
but why does 00 checksum a number HIGHER than 01??Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
August 20, 2011 at 11:44 pm #3145the checksum is a complicated beast sometimes, usually setting it to 00 means accept the message anyway, but there might be a algorithm for that, i think i added one of those in the sysex editor.
September 4, 2011 at 2:37 am #3146ok. I’m stuck on this again.
From the JP manual:
how to calculate the checksum[i:1i6p0ylb]The following formula shows how to calculate the checksum when the exclusive message to be transmitted has an address of aa bb cc ddH and data or size of ee ffH
aa+bb+cc+dd+ee+ff=total
total /128 = quotient…remainder
128 – remainder = checksum
[/i:1i6p0ylb]ok. how do i calculate checksum within ctrlr? I think this is probably why that other JP-8080 panel never was posted here ;p
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
September 4, 2011 at 11:55 am #3147have a look at the math library of LUA (http://www.lua.org/manual/5.1/manual.html look for math.fmod)
also LUA has the modulo operation
[code:1pooxp1c]
Lua 5 % Divisor
Lua 4 mod(x,y) Divisor
[/code:1pooxp1c]also i wrote a jp8080 checksum method for Ctrlr and it can be used in the SysEx editor, it looks like this:
[code:1pooxp1c]
void CtrlrSysexProcessor::checksumRolandJp8080(const SysExToken token, MidiMessage &m)
{
/*
Since +5 is parameter value 1DH,
F0 41 10 00 06 (model id) 12 (command if) 01 00 10 03 (address) 1D (data) ?? (checksum) F7Next we calculate the checksum.
01H + 00H + 10H + 03H + 1DH = 1 + 0 + 16 + 3 + 29 = 49 (sum)
49 (total) 128 ÷ 0 (quotient) ... 49 (remainder)
checksum = 128 – 49 (quotient) = 79 = 4FHThis means that the message transmitted will be F0 41 10 00 06 12 01 00 10 03 1D 4F F7
*/String str;
const int startByte = token.position – token.data0;
double chTotal = 0.0;
uint8 *ptr = m.getRawData();for (int i=startByte; i<token.position; i++)
{
chTotal = chTotal + *(ptr+i);}
const double remainder = fmod(chTotal, 128);
const uint8 ch = (uint8)(128 – remainder);
*(ptr+token.position) = ch;
}
[/code:1pooxp1c]September 5, 2011 at 3:31 am #3148thanks Atom.
I’m not sure how I use your jp8080 checksum method in the sysex editor.. the sysex editor’s functionality seems to be limited to adding / subtracting to the length of the message and entering values. what value do i put in the checksum’s spot to specifically call your jp8080 checksum method?thanks again
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
September 5, 2011 at 9:38 am #3149right click on a byte in the sysex editor to see "other" options ” title=”Smile” />
September 5, 2011 at 7:53 pm #3150shit goddamn, atom you really have thought of everything, haven’t you.
thank you once again atom.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
June 4, 2015 at 2:27 am #49067I figured it out. I was getting parameter changes but without proper checksum. Thank you!
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.