Two's complement question/issue? [SOLVED]

Triton Rack midi sysex for parameter change:

I am stuck on dealing with negative values when setting params like:

For example, let’s consider Transpose, Tune and Freq. offset here. Korg seems to expect applying two’s complement at 8 bits always, since they equate -12 to F4, -50 to CE and -100 to 9C (offset moves by 0.1hz so there are 100 divisions). If I am able to get two’s complement at 8 bits, then I can apply the value format logic given above, split it into two bytes and send it across.

But, Electra seems to deal with two’s complement only to up to the number of bits needed to represent the negative number. For example, two’s complement of -12 needs 5 digits (at least). And so, E1 seems to convert -12 as just 10100. In this case, Korg actually needs 11110110.

Is there any clever way in which I can manage to derive what Korg wants from what E1 gives? Or does this need an enhancement to E1’s two’s complement logic to also ‘ask’ for a number of bits property?

I am hoping there is a way or else I am probably gonna have to give up on my Korg EXB MOSS for the time being since it deals with ton of modulation properties which all have negative and positive values.

@martin, please let me know if my explanation isn’t clear. Midi implementation document for EXB MOSS is here: http://www.korg-datastorage.jp/Software/MIDIImp/TRITON_RACK.pdf

1 Like

@shankar your explanation is perfectly clear, Also, your observation is correct. Up to firmware 1.5 Electra calculated the sign bit position dymamically based on the range. It worked with the devices I worked with. @jigdagod later reported the same issue as you have with the Hydrasynth.

I added the bitWidth attribute that tells Electra where sign bit should be placed. This attribute is available in the upcoming firmware release. You can either test it with the beta release available at New ElectraOne console / Testing needed or wait couple of days. As mentioned in some other thread the new firmware goes out soon.

2 Likes

This makes my day, thank you! Will check it out as soon as I am able to today. Glad that my triton is still a go :slight_smile:.

1 Like

I tested the bitWidth feature with the beta release and beta editor. I definitely see the behavior change, but it looks like the bitWidth logic is internally capped at 7 bits. For example, I get 1001110 for -50 and 1110100 for -12 even if I set bitWidth to 8 or 9. Could you please check if you see this as well?

I checked bitWidth in 1.5.11 as well. Same issue as I mentioned in the post above. It seems like the value is capped at 7 bits. So, where I expect CE, I get 4E and where I expect F4, I get 74 etc. When you get a chance, please take a look :slight_smile:.

oh, I see where the problem might be I think :slight_smile:

The data midi bytes (as opposite of status bytes) are limited to to 7bits (0 … 127) In your example, the CEh cannot be transferred as a data byte. so while electra has the value CEh you need to use rules to split it into two bytes LSB: 4Eh and MSB: 01h and place them to correct positions of the sysex messages. I hope you catch my drift.

The idea is shown in the Two nibbles example in Writing SysEx templates | Electra One Documentation. You would only adjust the parameterBitPosition accordingly.

1 Like

This makes total sense and I should have thought about it for sure! Gonna check it out in a few and will let you know. Thanks!

Works like a charm! Time to finish sysex for all the remaining controls :slight_smile:. Gonna bother you again about the patch reading issue. If that’s taken care of as well, I think I will have a fully functional MOSS preset :slight_smile: