Sysex Checksum Calculation

Heavenstorm

2007-02-03 23:35:00

I am using MT with a Roland Fantom XR.
There are many values that I would like to change internally. They are using SYSEX similarly to control change messages. There is an address, and then the data. The problem is the second before last two digits are a checksum.

Can MT solve for this checksum?

Here is an excerpt from the manual:

(1)(2)(3)(4)......10 00 04 00...02..............??.........F7
..................... address.........data...... checksum (6)

(1) Exclusive Status (2) ID (Roland) (3) Device ID (17)
(4) Model ID (Fantom-XR) (5) Command ID (DT1)(6) End of Exclusive

To solve for the checksum you must take the address and do this:

10H + 00H + 04H + 00H + 02H = 16 + 0 + 4 + 0 + 2 = 22 (sum)
22 (sum) รท 128 = 0 (quotient) ... 22 (remainder)
checksum = 128 - 22 (remainder) = 106 = 6AH

This would open up many possibilities for controlling any Roland Fantom X series gear. If anyone could figure this out It would be greatly appreciated.

Chris

admin

2007-02-12 09:22:32

Hi Chris,

with the Rules feature of Midi Translator Pro (currently in public beta phase), you should be able to achieve the checksum calculation. Currently, the MOD function is not available (i.e. the remainder of a division), but you can help yourself with e.g.:

Let gs be the sum, then you can calculate the remainder gr like this:

Code: Select all

gq = gs / 128
qq = gq * 128
gr = gs - gq
And actually, for the bit-savvy people: because this is a division by 128, we can just use Midi Translator's AND operator:

Code: Select all

gr = gs & 0x7F
One more thing: are you sure that the checksum is calculated at the end with "128 - remainder"? Because the remainder will always be in the range 0...127, and subtracting that from 128 will yield a range for the cheksum from 1..128. But you can only send values from 0..127 with MIDI... worth checking out.

In any case, let us know how it works.

Regards,
Florian

Heavenstorm

2007-02-26 04:09:16

I created a spreadsheet for the hex calculation to see how it compared to the data from the unit. (Fantom XR)
It works great until the data value exceeds 24H. 24H is when GS is greater than 128.

Here is what the data looks like in with the corresponding values:

Patch 34 sysex= F0 41 10 00 6B 12 01 00 00 04 57 00 22 02 F7
Patch 35 sysex= F0 41 10 00 6B 12 01 00 00 04 57 00 23 01 F7
Patch 36 sysex= F0 41 10 00 6B 12 01 00 00 04 57 00 24 00 F7
Patch 37 sysex= F0 41 10 00 6B 12 01 00 00 04 57 00 25 7F F7

Calculated checksum (from spreadsheet) for:
Patch 34 = 2F (correct)
Patch 35 = 1F (correct)
Patch 36 = 1F (incorrect)
Patch 37 = 0F (incorrect)
Patch 38 = FFFFFFFFFF (seriously incorrect)

Unfortunately I'm pretty ignorant about the math behind this, but it seems to me that your suggestion will break down after the data value exceeds 23F.

Maybe I'm missing something.
Also as a note the highest patch number on the unit is 128 before the patch address changes.

Thank you for looking into this.
Chris