From the original SynthMaker forum (2004–2014), with its members’ names and dates.
Arkuzz ·
Hello!
I want to create an advanced midi controller VST for my Roland MC-307 (which is basically an MC-505) and it will control the unit via SysEx. No problem with midi event generating, but theres a problem with the checksum computing.
The formula is:
"The checksum consists of a value whose lower 7 bits are 0 when the address, size and checksum itself are added.
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"
This means that the message transmitted will be F0 41 10 00 0B 12 01 00 00 28 05 52 F7.
How can I write this in SM?
Thanks and best regards!
Grassfield
MichaelBenjamin ·
i think you can do that with hex-to int conversion, you can then calculate the checksum with int math primitives and then convert it back to hex.
trogluddite ·
As long as you use Integers, you can generate the /128 remainder with an integer AND operation.
Here's a schematic showing the HALL2 parameter example from your post...
...the example works because the definition of your checksum states that the lowest 7 bits are the important ones. Doing an integer AND with 127 (Binary '01111111' - 7 bits are 'on') is an example of 'masking' - it will keep only the information in the lowest 7 bits and discard all the others. Here's another example that keeps only the lowest four bits...
You can see that the bits from the start value only appear in the result where the mask value has '1's. Where the mask value has '0's, those parts are 'thrown away' from the start value. This only works with integers though, doing it with float values will not work because the binary bits are used in a different way for floats.
Arkuzz ·
trogluddite, a very big thanx for your help! Thank you thank you thank you! 🙂
1-2-Many ·
Hi,
The Int Modulus works swell too:
As does basic math:
I wonder, of the three, which is fastest.
Wrote something here? To have a post removed or your name hidden, write to [email protected].