BCR 2000 and negative value in sysex !!

23 posts / 0 new
Last post
lokaz
lokaz's picture
BCR 2000 and negative value in sysex !!

Hello everyone, I introduce myself my name is Julian, I live in France and it's been a few months since I started in the world of sysex, being lost in the middle I acquired a BCR 2000 to control all my devices namely my proteus 2000 , my Xtrem Lead and my Roland R8.

I am beginning to understand how sysex works only I have a problem for negative values!

Currently I want to control the transpose master of my proteus 2000 and here is what the manual says:

MASTER_TRANSPOSE  id=259 (03h,02h) min = -12 ; max = +12

C = -12    C# = +1

C# = -11    D = +2

D = -10    D# = +3

D# = -9    E = +4   

E = -8 F = +5

F = -7    F# = +6

F# = -6    G = +7

G = -5    G# = +8

G# = -4    A = +9

A = -3    A# = +10

A# = -2    B = +11

B = -1    C = +12

off (C) = 0

 

Well I confess I did not understand why they put notes that correspond to a value! It's not clear to me! maybe you could explain to me? For my part here is the sysex code that I put on an encoder and that allows me to go from 0 to +24 semitones on my Proteus 2000:

F0 18 0F 00 55 01 02 03 02 val1.7 val8.11 F7

 

Now I try to do the opposite, go from 0 to -24 semitones but nothing to do, I tried a lot of combinations, nothing to do, can be particular values ​​to go somewhere? I'm lost, if you could help me or point me on this point I would be very happy, thank you very much to the community :)

 

Julian

 

Mark van den Berg
Mark van den Berg's picture

Hi Julian,

First a minor point of criticism: it would have helped if you had been more precise about "the manual" of the Proteus 2000 (or even provided a download link): it took me about ten minutes to find the right one, namely "Proteus Family [...] System Exclusive Specification Version 2.2":
http://www.cyborgstudio.com/synthmp3s/emu/px7/manual/px7systemexclusivespecification2_2.pdf

Anyway, on p. 82 this document explains how negative numbers must be encoded in Proteus SysEx messages:

If the data value is negative, you must first take the 2's complement of the
number: In the case of a 14-bit number this is equivalent to adding 16384
to the original negative value.

To fit the 7-bit MIDI protocol, numbers must be “nibble-ized”.

[...]

To get the 14-bit nibble-ized value (of a positive value or a 2's
complemented negative value):
msb = value DIV 128 (divide and ignore the remainder)
lsb = value MOD 128 (divide and use only the remainder)

So for instance the minimum value of MASTER_TRANSPOSE, -12, translates to -12+16384 = 16372.
The Proteus SysEx message format requires you to send this value as two 7-bit bytes (first the LSB, then the MSB), where bit 7 (the most-significant bit) of each byte isn't used (i.e. is 0).
So 16372 must be sent as $74 $7F. (You can use the MIDI data calculator window of BC Manager or MIDI Tools to calculate these values - that's what I did.)
So the full SysEx message is F0 18 0F 00 55 01 02 03 02 74 7F F7. (You may want to try this to see if it works.)

Unfortunately the BCF2000 and BCR2000 don't allow negative range limits. This is a well-known problem, for which people have come up with various work-arounds, depending on the situation.
In any case a range with 16372 ("-12") as the minimum and 12 as the maximum doesn't have the right result: turning the encoder clockwise you then go from 16372, 16371, 16370 all the way down to 14, 13, 12.
So I'm not sure whether there's a satisfactory way to work around your specific problem.
Obviously you could "simply" define the full 14-bit range of 0 to 16383 and put "val0.6 val7.13" in the SysEx message definition, but you would then have to keep turning the encoder for an eternity to get from the positive transposition subrange (0...+12) to the negative subrange (-12...-1, i.e. 16372...16383).

Hopefully this has clarified things a bit - pun not intended smiley

Mark.
 

lokaz
lokaz's picture

Hi Mark,

It is true that I should have put you a link to the documentation please excuse me, yes I read this part on page 82 without understanding too much, please excuse me I really start in this world and this is very complicated for me ^^ I will already test what you told me and do several tests, I will re-read this documentation and try to find a trick or a workaround !

 

In any case thank you for giving me such a precise answer that enlighten me for the future, I'll keep you informed of my developments on my project! please excuse me for the lack of details as I told you I start in the world of sysex and I still have plenty to learn, but a very exciting environment to multiply the possibilities in live! thank you :)

 

 

lokaz
lokaz's picture

Ok Mark, your solution works perfectly indeed by inserting this code I can go from -12 to -1 (F0 18 0F 00 55 01 02 03 02 val0.6 val7.13), I put the value 1 to 16372 and value 2 at 16383, everything is ok!

Now that I know the methods to make positive and negative, the problem is how to trick so that everything is on a single encoder! Hoping that maybe other members answer me, I will continue to search the forum and see if I find a trick, if anyone else to a trick I'm a taker! Mark again thank you very much yessmiley

sams
sams's picture

Hi Lokaz. I found a trick to control the Emu negative numbers via the BC2000. As you requested, I can turn a knob on my BCR2000 and the transpose on my Morpheus goes from -12..-11.. to +12 without any jumps or gaps. The idea is to use the BC2000 checksum feature, not because you actually want a checksum, but because it lets you do some very simple logical operations. 

I incorporated this trick into an ini file for Mark's nice BC utility that works with my Emu Morpheus. I only did the per instrument parameters (including transpose) but I expect you could do the master transpose in a similar way. I would expect the Morpheus sysex to be very similar to the Proteus sysex. 

My file is called MorpheusMixedSign.ini, in Mark's user files section https://mountainutilities.eu/userfiles/b-control/4713

I can explain more if you like, but maybe this is enough to get you going. 

 

lokaz
lokaz's picture

Hello Sams, ok but that's great! yes I think it must be similar, I'll look at it in detail, I'll look at your file and analyze it to seesmiley

 

If I do not find it yes I want help, I'll let you know Oui

lokaz
lokaz's picture

Hello sams, good I confess that I got a little lost ........ I analyzed your file with "Notepad ++" and I understand that you declare at the top the device in question, but the rest I can not understand everything! How do you assign these instructions to your encoders? There are a lot of points that I can not understand! Excuse me for my misunderstanding, the devellopement is not easy for me ^^

sams
sams's picture

Hi, the ini file is for BC Manager. When you are laying out your knobs in BC manager, you can choose to insert a sysex parameter. Then, press "open" (third from left?) to show the folder where all the ini files are. There should be a-880 ini files etc already there. This is where you should put your ini files, and then you will be able to map all the parameters to your encoders. I find this quite a handy way of quickly mapping out different layouts.

In this post on the yahoo group I first tried to explain the idea of using checksums to encode negative numbers: 

https://groups.yahoo.com/neo/groups/bc2000/conversations/messages/5513

If I get time later I will have a go at working out a string of codes for master transpose. 

lokaz
lokaz's picture

ok this is great !! But I just tried with several different codes, it does not work: /

Here is the code I inserted:

$ F0 $ 7D val7.13 cks-1 2 $ 4E val0.6 $ F7 $ F0 $ 18 $ 0F $ 00 $ 55 $ 01 $ 02 $ 03 $ 02 val0.6 cks-3 $ 3 F7

I put the value 1 to 0 and the value 2 to 48 ...

but to be honest I understood what you want to do with this type of code but it is the format that I have trouble! decidedly XD

lokaz
lokaz's picture

 

Good I admit to being in a stalemate .....

lokaz
lokaz's picture

 

With your method sweeping my knob I go from -24 to +24 at once at a time! weird

sams
sams's picture

Hi, I don't have a Proteus 2000 and the sysex is a bit different so I can't test it myself.

However, I used the following string:

$F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $55 $01 $02 $03 $02 $F7 $F0 $18 $0F $00 $55 $01 $02 $03 $02 val0.6 cks-3 6 $F7 $F7

with Value 1 as 116 and Value 2 as 140 (decimal). (These numbers are 12 either side of 127.) 

This generates 

F0 18 0F 00 55 01 02 03 02 74 7F F7

at the lower end through to

F0 18 0F 00 55 01 02 03 02 0C 00 F7

at the top end. Hope that is roughly what you need? Maybe I am out by 1.

By the way, I designed the code string above so that hopefully you can easily modify it to change a different parameter -- you should just need to change the parameter choice and instruction (55 01 02 03 02) which appears twice in the string. 

lokaz
lokaz's picture

wAHOOO !!!!!

lokaz
lokaz's picture

 

Well I will quietly analyze your code and really try to understand all the details but it works! it goes from -12 to +12 semitones but hey it works anyway, the logic is! A big thank you sams, you are fromidable, so you take me a thorn! now I really have to understand what I'm doing when I apply this code! The sysex is really full of mysteries !!

lokaz
lokaz's picture

 

So as it is in Semitones on the proteus I had to change the value 1 to 102 and value 2 to 152, it works perfectly from -24 to +24! I do not know how to thank you but thanks to this logic I will be able to advance on the rest !! Thank you again Sams, I would be happy to have your advice and tips on the world of sysex!

sams
sams's picture

Great! Glad to hear it worked. It's gratifying when you get it to work, isn't it!

Do upload your results to the user files section in case any one else has a Proteus + BC!

 

lokaz
lokaz's picture

 

Ah, but of course, already I will be able to advance on the other points to controller, but already know how to do the negative and positive will help me a lot !! It is obvious that once I have a nice little template yes I would post it here without problems, anyway I still have not finished my story with this controller and I would not hesitate to solicit you again, great thank you to you and the creator of this software :

lokaz
lokaz's picture

 

But I think that I will put some time even before finishing to put in place all the controls of this series proteus ^^ in any case once finished I would benefit the community and also a forum in France where I am very active ;)

Macac
Macac's picture

Hey !

I'm trying to program my bcr to control my E-mu Orbit V2 9090. Comparing the manuals, it seems that the proteus and the orbit are using the same logic for negative numbers so i'm very interested into this topic... I tried to import the lines from the morpheusmixedsign.ini file but the software is saying "Warning:line 1: item13: Byte after SysEx message causes spurious output" (with the P Coarse tune line: $F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $55 $41 $F7 $F0 $18 $0C $00 $03 $55 $41 val0.6 cks-3 6 $F7 $F7)

What I am doing wrong (I know I need to change the specific device number but if the software don't accept the line I can't go futher anyway) ?

locaz, could you please share your program ? Proteus and Orbit are very similar and I would be very useful to me !

Sorry if my english is bad sometimes, I'm french too ;)

Mark van den Berg
Mark van den Berg's picture

if the software don't accept the line I can't go futher anyway

BC Manager only warns you that the output will produce spurious output (more on this below). It does accept the line, so you should be able to upload the definition to your B-Control, etc.

What I am doing wrong

As section 13.7 of BC MIDI Implementation.pdf explains, if there are two SysEx messages on the same line, the B-Control will output one to three spurious bytes between the two SysEx messages.
So normally this is undesired, which is why BC Manager warns you about this.
However, the trick with cks-2 and cks-3 requires that the two SysEx messages are on the same line, so these spurious bytes are unavoidable.

But you should make sure that the receiving device doesn't act on these spurious messages.
For instance, I've just tested an example provided earlier in this topic by user "sams":
$F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $55 $01 $02 $03 $02 $F7 $F0 $18 $0F $00 $55 $01 $02 $03 $02 val0.6 cks-3 6 $F7 $F7
What happened in my test was that the spurious output sequence "03 02" (stemming from the end of the first SysEx message in the definition) got returned to BC Manager's "MIDI input messages" window as "B9 03 02". Since this is a Control Change message, a receiving device could easily act on this spurious message.
The insertion of "B9" in my test must have occurred because the MIDI input driver of Windows 7 applies "running status" logic: when a MIDI message starts with a data byte ($00-$7F) instead of a status byte ($80-$FF), the most recently received MIDI status byte is inserted. So the end result can be a bit of a lottery, with potentially very undesired effects.

By the way, I don't understand why there are two $F7 at the end of sams' and your definitions. Maybe user "sams" (who came up with this brilliant cks-2/cks-3 trick) could explain this, if he/she is still around. But at least in my test the desired SysEx output was also produced if the definition contained only one $F7 at the end. As far as I could see, the only effect of having two $F7's at the end was that each time I touched the encoder I didn't get one but two spurious output messages. But maybe I'm missing something here. Anyway, you might want to check whether things work for you without the extra $F7; the fewer spurious output messages, the better...

Mark.

Macac
Macac's picture

First, thanks for the quick answer, I didn't think it would be so fast !

I tried the Sams's formula with the needed changes (and without the extra F7 at the end) to correspond to the command I want: $F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $03 $50 $00 $F7 $F0 $18 $0F $00 $03 $50 $00 val0.6 cks-3 6 $F7 with the min value 0 and the max 255 (I want it to go from -128 to 127)

Here the outputs: when the value is 0: F0 18 0F 00 03 50 00 00 7F F7

when the value is 255: F0 18 0F 00 03 50 00 7F 00 F7

so the 8th and 9th number are what the machine expect to make the -128 and 127.

but the needed messages begin with: F0 18 0A...

If I modify the formula like this: $F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $03 $50 $00 $F7 $F0 $18 $0A $00 $03 $50 $00 val0.6 cks-3 6 $F7

the outputs are: with the min value: F0 18 0A 00 03 50 00 00 7A F7

with the max value: F0 18 0A 00 03 50 00 7F 05 F7

so the beginning is good, but not the 8th and 9th numbers (the machine goes straight to -128 when the value is "negative" (0-127) and to 127 when the value is "positive" (128-255) without any intermediate)

then I thought that the first part of the formula is only there for the "cks-2 cks-3 trick" and I tried to modify some number to see what happens, and after a few tries I found one formula that outputs what I want (I took the original first part without the modifications, and I changed some numbers): $F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $55 $02 $03 $02 $F7 $F0 $18 $0A $00 $03 $50 $00 val0.6 cks-3 6 $F7

which outputs: with the min value: F0 18 0A 00 03 50 00 00 7F F7

with the max value: F0 18 0A 00 03 50 00 7F 00 F7

And the machine acts as expected: nice !

But I need to write other formulas for different fonctions, and modifying the working formula changing only the numbers of the second part doesn't work, like in the second formula i describe in this message... I guess with many tries I can find formulas that work, but I prefer to understand what I'm writing instead... I can't access to the yahoo link posted by sams so I can't have his explanations about the "cks-2 cks-3 trick" and I have difficulties to understand the explanations about this fonctions in the manual (english is not my native language)... can someone explain it to me ? Or at least give me a link to help me understand ?

--

Here is two other formulas I tried and that don't work well:

$F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $55 $02 $03 $02 $F7 $F0 $18 $0A $00 $03 $44 $00 val0.6 cks-3 6 $F7

Actual output with the min value 0: F0 18 0A 00 03 44 00 00 6B F7 // Expected output F0 18 0A 00 03 44 00 00 7F F7

Actual output with the max value 255: F0 18 0A 00 03 44 00 7F 14 F7 // Expected output F0 18 0A 00 03 44 00 7F 00 F7

--

$F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $55 $02 $03 $02 $F7 $F0 $18 $0A $00 $03 $49 $00 val0.6 cks-3 6 $F7

Actual output with the min value 0: F0 18 0A 00 03 49 00 00 66 F7 // Expected output F0 18 0A 00 03 49 00 00 7F F7

Actual output with the max value 255: F0 18 0A 00 03 49 00 7F 19 F7 // Expected output F0 18 0A 00 03 49 00 7F 00 F7

Macac
Macac's picture

After many tries, I've found the working formulas for the two last examples:

$F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $03 $41 $00 $F7 $F0 $18 $0A $00 $03 $44 $00 val0.6 cks-3 6 $F7

$F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $03 $4C $00 $F7 $F0 $18 $0A $00 $03 $49 $00 val0.6 cks-3 6 $F7

But I still wan't to understand it so some explanations are still welcome :D

 

Mark van den Berg
Mark van den Berg's picture

Sams explains how it works in post #12 above:

I designed the code string above so that hopefully you can easily modify it to change a different parameter -- you should just need to change the parameter choice and instruction (55 01 02 03 02) which appears twice in the string.

So consider Sams' example from post #12:
$F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $10 $55 $01 $02 $03 $02 $F7
$F0 $18 $0F $00 $55 $01 $02 $03 $02 val0.6 cks-3 6 $F7 $F7

First, "cks-2 2" puts bits 0-6 of the sum of $00, $00, val7.13 and $7F into the byte at position 6 of the output sequence (i.e. in the first, "auxiliary" SysEx message).
Then, "cks-3 6" copies the byte at position 6 to the end of the second ("main") SysEx message.
However, "cks-3 6" actually xor's bits 0-6 of every byte from position 6 up until cks-3 itself.
So to only get the byte from position 6, all the bytes between position 6 and cks-3 must cancel each other during the xor process.
Since xor'ing any byte with itself yields zero (N xor N=0), this cancellation can be done by duplicating (at the end of the first message) all the bytes that are required between position 6 and cks-3, i.e. the $F7 terminating the first message, the $F0 starting the second message, and all the other bytes in the second message up to cks-3.
This is why Sams' first SysEx message duplicates "val0.6" and "$55 $01 $02 $03 $02".
However, Sams lumps the "invariant" "$F7 $F0 $18 $0F $00" together:
$F7 xor $F0 xor $18 xor $0F xor $00 = $10

In your case, the invariant "$F7 $F0 $18 $0A $00" leads to $15.
So you could use the following pattern:
$F0 $7D $00 $00 val7.13 $7F cks-2 2 val0.6 $15 [parameters] $F7
$F0 $18 $0A $00 [parameters] val0.6 cks-3 6 $F7

But I think the first SysEx message of this pattern can be further simplified:

Firstly, I don't see the need for "$00 $00", so you could use:
$F0 $7D val7.13 $7F cks-2 2 val0.6 $15 [parameters] $F7
$F0 $18 $0A $00 [parameters] val0.6 cks-3 4 $F7
Note that the second message here contains "cks-3 4", since "cks-2 2" is now at position 4.

Secondly, to make the first SysEx message as short as possible (which will speed up MIDI communication), you could collapse all compensational bytes (except val0.6 of course) into one:
CompensationByte = $15 xor Parameter1 xor Parameter2 xor Parameter3 ...
So then the pattern becomes:
$F0 $7D val7.13 $7F cks-2 2 val0.6 CompensationByte $F7
$F0 $18 $0A $00 [parameters] val0.6 cks-3 4 $F7

At least this is what I would probably do, but of course you'd need a calculator for this.
I'll think about implementing this in BC Manager somehow.

Hope this helps,
  Mark.