SynthMaker

New to SynthMaker: XOR for sysex checksum?

Archive · 2011 4 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

Power Chord ·

Hello all, greetings from Brittany, France.

I'm new to SynthMaker. My goal is to create a device panel to control a hardware guitar effect rack. This device is only understanding sysex messages, with a twist: it needs a XOR checksum of all the bytes but the first one (F0).

From SynthMaker manual and searching the forum, if I'm not mistaken, bitwise AND and OR operators are available but not the XOR one, and the - (minus) can be used as a NOT operator, thus allowing me to do "a ^ b" as "a & (-b) | (-a) & b"). Am I correctly understanding?

Next, if I am indeed able to do this bitwise XOR, would it then be possible to loop through a sysex string starting from the first byte after the initial F0, XOR the bytes, and add the resulting checksum to the sysex string followed by the final F7?

Thanks to all for your help.

trogluddite ·

Welcome to SM, PowerChord.

The most recent version of SM does have bitwise XOR and NOT available - they were added very recently, so maybe if you are using SM Free, or Fruity Loops version, you don't have them. If you are using an older version, I would suggest upgrading if you can. Previous versions of SM had a bug with the SysEx components that prevented SysEx from being transmitted properly - I believe that this was only fixed very recently (SM2.0.5)

A bitwise NOT, is actually (-1)-x; a simple inversion will be one too many due to the way that 'two's complement' works for negative numbers. The other thing to watch is that the bitwise operators always assume that you are using the full 32bits available - so you will also need to use '& 127' to make sure that you mask out the bits that you don't want. Here's a little schematic with the modules I use from my own toolbox; I've included the 'discrete' versions in case your version of SM does not have the new components available.

Generating the checksum will be possible using an 'Integer Loop' to extract pairs of hex digits from your sysex string, and then accumulate the successive XOR operations to leave your 'Parity' checksum. That's a bit more complex to explain, but if I have time, I'll see if I can come up with an example of how that works.

One other point - do your SysEx strings contain multiple parameters? For example, if each SysEx string contains only one variable value, you may only need to XOR the variable value with the partial checksum for all the fixed numbers. This would make your controls much more responsive, as looping a whole SysEx string will use much more CPU power.

Power Chord ·

@trogluddite: Thanks a lot for your explanations.

I'm using the latest free version. If it fulfills my needs, I'll upgrade to the full one.

The sysex strings only contain one parameter at a time, but if its value is over 7F, it is spread over two bytes using the "super-7 message packing" (aka 7+7 scheme). But I guess I will be able to deal with this. And I will use a partial checksum as most of the bytes are always the same.

If it is not too much asking, I'll take your integer loop example (no hurry though, I'm barely starting with SM).

Thanks for your time, I really appreciate.

[Edit:] with your example, I realized that SM do indeed have Integer XOR. Somehow I had missed it.

trogluddite ·

Hi Again,

I have posted a little schematic with checksum generators and an MSB, LSB splitter on the thread HERE. Hope you find them useful - don't be afraid to post again if you would like any help understanding how they work.

You might also find my (not finished yet!) tutorial about SM's 'Green Triggers' useful for an insight into some of the signal flow - you can download it as a .pdf from HERE.

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.