Author Topic: Roland Sysex Checksum calculator  (Read 352 times)

0 Members and 1 Guest are viewing this topic.

Offline philjynx

Roland Sysex Checksum calculator
« on: August 13, 2017, 02:09:30 AM »
Saw one or two people asking for a spreadsheet calculator for this, so I wrote one.
You can find it here http://www.vguitarforums.com/smf/index.php?action=downloads;sa=view;down=96
« Last Edit: August 14, 2017, 06:06:46 AM by gumtown »
I am playing all the right notes. But not necessarily in the right order.

Offline Beanow

Re: Roland Sysex Checksum calculator
« Reply #1 on: August 13, 2017, 11:03:02 AM »
This caught my attention since it's implemented differently from what I have in Go code. For the 5 byte example it works as expected. For a large sample (245 input bytes) I get different results.

Indeed 40 11 00 41 63 => 0B

Another one that I grabbed from a real-world command, enables BTS mode.
7F 00 00 01 01 => 7F

The other two examples I placed in here are sections of an entire patch being reported back by the Katana.
Sorry for butchering the markup!

Golang checksum function for reference. https://github.com/katana-dev/lib-katana/blob/develop/sysex/message.go#L58
And in Python https://github.com/snhirsch/katana-midi-bridge/blob/master/katana.py#L78

Main difference is the MOD is applied after every addition.

Offline philjynx

Re: Roland Sysex Checksum calculator
« Reply #2 on: August 13, 2017, 01:17:36 PM »
This caught my attention since it's implemented differently from what I have in Go code. For the 5 byte example it works as expected. For a large sample (245 input bytes) I get different results.

Indeed 40 11 00 41 63 => 0B

Another one that I grabbed from a real-world command, enables BTS mode.
7F 00 00 01 01 => 7F

The other two examples I placed in here are sections of an entire patch being reported back by the Katana.
Sorry for butchering the markup!

Golang checksum function for reference. https://github.com/katana-dev/lib-katana/blob/develop/sysex/message.go#L58
And in Python https://github.com/snhirsch/katana-midi-bridge/blob/master/katana.py#L78

Main difference is the MOD is applied after every addition.

Argh! Does that mean what I posted is no good? I've looked a the two links you gave but they left me dead in the water.

I used this as the model which only mentions 5 bytes, so I wrote for 5 bytes (from  http://www.2writers.com/eddie/tutsysex.htm):
 The manual shows a different method which involves slightly more complicated arithmatic. If you prefer this method then by all means use it.
 
 In essence it involves adding all the values together, dividing by 128 and subtracting the remainder from 128. Thus:
1. Convert hex to decimal: 40h = 64 11h = 17 00h = 0 41h = 65 63h = 99 2. Add values: 64 + 17 + 0 + 65 + 99 = 245 3. Divide by 128 245 / 128 = 1 remainder 117 4. Subtract remainder from 128 128 - 117 = 11 5. Covert to hex: 11 = 0Bh


 
I am playing all the right notes. But not necessarily in the right order.

Offline Beanow

Re: Roland Sysex Checksum calculator
« Reply #3 on: August 13, 2017, 01:41:29 PM »
They mentioned a step in that tutorial you've skipped.

 2. Add the values together, but if the answer to any sum exceeds 127 then subtract 128.

Edit: I see they mentioned your version as a second approach.
Perhaps this is where it comes from? Both code examples use the first approach.
« Last Edit: August 13, 2017, 01:47:04 PM by Beanow »

Offline snhirsch

Re: Roland Sysex Checksum calculator
« Reply #4 on: August 13, 2017, 02:22:23 PM »
2. Add the values together, but if the answer to any sum exceeds 127 then subtract 128.

Yes, MOD 128 (aka 7-bit overflow) is always how I've understood it.

Offline alexmcginness

Re: Roland Sysex Checksum calculator
« Reply #5 on: August 13, 2017, 02:37:34 PM »
WOW. I remember the days back when the SC-55 sound canvas came out and we had to use a calculator to work this out and that was after I reversed engineered it from some code that Peter Ganon put into the atari version of Band In a Box. He later showed me how he figured it out. Havent used them for a dogs age. Nice to see a calculator that will work this out for ya.
VG-88V2, GR-50, GR-55, 4 X VG-99s,2 X FC-300,  2 X GP-10 AXON AX 100 MKII, FISHMAN TRIPLE PLAY,MIDX-10, MIDX-20, AVID 11 RACK, BEHRINGER FCB 1010, LIVID GUITAR WING, ROLAND US-20, 3 X GUYATONE TO-2. MARSHALL BLUESBREAKER, SERBIAN ELIMINATOR AMP.

Offline gumtown

Re: Roland Sysex Checksum calculator
« Reply #6 on: August 13, 2017, 07:31:36 PM »
Here attached is an old windows 16bit checksum calculator program.
It will only run under windows Xp or earlier.
It is zipped for posting, so it needs to be de-compressed first.
Free "GR-55 FloorBoard" editor software from http://sourceforge.net/projects/grfloorboard/

Offline philjynx

Re: Roland Sysex Checksum calculator
« Reply #7 on: August 13, 2017, 08:51:36 PM »
This caught my attention since it's implemented differently from what I have in Go code. For the 5 byte example it works as expected. For a large sample (245 input bytes) I get different results.

....

I've just re-read this! No wonder you get different results, the sheet as it stands has 5 labelled single byte fields to enter. Put petrol in a diesel car and you'll get undesirable results too.

I've just uploaded a revised sheet to handle max 250 bytes. http://www.vguitarforums.com/smf/index.php?action=downloads;sa=view;down=96  It might be a good idea for one of the moderators to remove the original file. Cheers!
« Last Edit: August 14, 2017, 06:07:48 AM by gumtown »
I am playing all the right notes. But not necessarily in the right order.

Offline gumtown

Re: Roland Sysex Checksum calculator
« Reply #8 on: August 13, 2017, 09:11:22 PM »
Removed original file and linked 1st post to new one.  ;)
Free "GR-55 FloorBoard" editor software from http://sourceforge.net/projects/grfloorboard/

Offline philjynx

Re: Roland Sysex Checksum calculator
« Reply #9 on: August 13, 2017, 09:14:26 PM »
Removed original file and linked 1st post to new one.  ;)

Thanks, can you kill off the second one - I goofed! This should be the clean functional one. http://www.vguitarforums.com/smf/index.php?action=downloads;sa=view;down=96
Thanks.
« Last Edit: August 14, 2017, 06:08:17 AM by gumtown »
I am playing all the right notes. But not necessarily in the right order.

Offline gumtown

Re: Roland Sysex Checksum calculator
« Reply #10 on: August 13, 2017, 09:53:27 PM »
Might want to check those links,
make sure I didn't delete revision 3 and link all to revision 2.

EDIT: sorted  ;D
« Last Edit: August 14, 2017, 06:09:28 AM by gumtown »
Free "GR-55 FloorBoard" editor software from http://sourceforge.net/projects/grfloorboard/

Offline Beanow

Re: Roland Sysex Checksum calculator
« Reply #11 on: August 14, 2017, 04:03:21 AM »
I've just re-read this! No wonder you get different results, the sheet as it stands has 5 labelled single byte fields to enter. Put petrol in a diesel car and you'll get undesirable results too.

Of course, that's why this was a great way to see if the math checks out  ;)
Looks like you password protected this one so I haven't had a look what you did differently. What changed?

Offline philjynx

Re: Roland Sysex Checksum calculator
« Reply #12 on: August 14, 2017, 04:36:42 AM »
Might want to check those links,
make sure I didn't delete revision 3 and link all to revision 2.

Oops! You did! I've uploaded the fixed one again.

Cheers.  :)
I am playing all the right notes. But not necessarily in the right order.

Offline philjynx

Re: Roland Sysex Checksum calculator
« Reply #13 on: August 14, 2017, 04:41:08 AM »
Of course, that's why this was a great way to see if the math checks out  ;)
Looks like you password protected this one so I haven't had a look what you did differently. What changed?

The change is only that it now has slots for 250 bytes, they get summed, then mod128 of their sum is subtracted from 128 like the 5 byte version.
You know the password  ;)
I am playing all the right notes. But not necessarily in the right order.

Offline Beanow

Re: Roland Sysex Checksum calculator
« Reply #14 on: August 14, 2017, 05:09:37 AM »
You know the password  ;)

iamgod1234?
admin?
Don't know really.

The change is only that it now has slots for 250 bytes, they get summed, then mod128 of their sum is subtracted from 128 like the 5 byte version.

So in other words, I just messed up expanding it?  :-X

Offline philjynx

Re: Roland Sysex Checksum calculator
« Reply #15 on: August 14, 2017, 06:19:04 AM »
iamgod1234?
admin?
Don't know really.

So in other words, I just messed up expanding it?  :-X

I  would never accuse you of that (being god, or of messing up expanding it). I just passworded it so it wouldn't get messed up! ;D

When I downloaded your version, excell moaned that it had to repair it, what it then displayed had no formulae in it.
 
I am playing all the right notes. But not necessarily in the right order.

Offline gumtown

Re: Roland Sysex Checksum calculator
« Reply #16 on: August 14, 2017, 06:34:23 AM »
It is easy to unprotect a password protected*.xlsx worksheet,
the checksum magic is in the hidden column.
Free "GR-55 FloorBoard" editor software from http://sourceforge.net/projects/grfloorboard/

Offline philjynx

Re: Roland Sysex Checksum calculator
« Reply #17 on: August 14, 2017, 07:36:55 AM »
It is easy to unprotect a password protected*.xlsx worksheet,
the checksum magic is in the hidden column.
Not often I get accused of magic! Everyone here knows the password!
I am playing all the right notes. But not necessarily in the right order.

Offline Beanow

Re: Roland Sysex Checksum calculator
« Reply #18 on: August 14, 2017, 09:21:01 AM »
When I downloaded your version, excell moaned that it had to repair it, what it then displayed had no formulae in it.

Of course Microsoft would be sure to treat libre office documents as broken. What was I expecting?