SynthMaker

Some math question

Archive · 2011 5 old posts

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"

Here is an example:

HALL2 is parameter value 05H,

F0 41 10 00H 0BH 12 01 00 00 28 05 ?? F7 (1) (2) (3) ( 4) (5) (6) address data checksum (7)

(1) Exclusive status (2) ID number (Roland)(3) device ID (17) (4), (5) model ID (MC-307)(6)command ID (DT1)(7) EOX

Next we calculate the checksum.

01H + 00H + 00H + 28H + 05H = 1 + 0 + 0 + 40 + 5 = 46(sum) 46 (total) ÷ 128 = 0 (quotient)...46 (remainder) checksum = 128 - 46 (quotient) = 82 = 52H

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...

54 decimal = 36 Hex = 00110110 Binary (start value) 15 decimal = 0F Hex = 00001111 Binary (mask value) INTEGER AND = 00000110 Binary = 06 Hex = 6 Decimal

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].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.