|
Post by gurbz on Jul 14, 2019 10:19:30 GMT
The midi log says when using CC20::
Message Out: Cmd=176|Ch=01|Data1=020|Data2=127 | Length=3: B0 14 7F Message Out: Length=15: F0 41 00 00 00 00 33 12 60 00 03 7C 7F 22 F7
Yep, that’s the slider up.
Looking now how to use the button now as FX1/fx2 toggle button, reading your posts again.
|
|
|
Post by gurbz on Jul 14, 2019 11:49:09 GMT
How do I understand the L80 and L81 ? Are they part of this range: # L0 L1 L2 L3 L4 L5 L6 L7 L8 L9 LA LB LC LD LE?
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jul 14, 2019 11:57:48 GMT
L80 and L81 are special internal variables used to flag what happens after the matching rules. These are looked at right at the end after the matching rules and the value of each of these determines what hapens next.
They are not part of the L0 to LE range.
if L80 is 1, then a katana sysex message gets sent (whatever is in L0-LE at the time)
if L81 is 1 then the original message (whether it be a katana sysex or a CC) will be blocked.
|
|
|
Post by gurbz on Jul 14, 2019 16:21:41 GMT
I am having trouble getting the CC20 button to work as a FX1/FX2 button. I am trying all sorts of combinations to get a feel with the template but I seem not to be able to grasp the logic behind this code.
How can I use the CC20 as toggle button: when OFF the original sysex (01 70) being send, when ON the modified sysex ( 03 7C) being send? Help!
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jul 15, 2019 9:49:26 GMT
Hi gurbz , OK, so let's modify the clause that handles the CC to simply remember the state and we will store that in L82: IF M0 == B0 14 ASS L80 = 0 1 M2 ENDSo, that means: - don't sent a katana message (L80 is 0) - block the incoming CC (L81 is 1) - store the current CC value (probably 0 or 7F) in L82 Now, in your other clauses, you can look at the value in L82 and do different things depending on if it is 0 or not, like, for example: # optionally convert fx1/31hz to fx2 IF MA == 01 70 IF L82 == 0 # fx1 (CC20) is active # don't send katana message and don't block ASS L80 = 0 0 END
IF L82 != 0 # fx2 (CC20) is active # send L0-E katana message and block original ASS L80 = 1 1
# convert fx1/31Khz to fx2 ASS LA = 03 7C M0C END ENDRegards, Nic.
|
|
|
Post by gurbz on Jul 15, 2019 16:57:55 GMT
Yeah it works! Awesome! I would never have dreamed this up, thanks so much Nic! This is the code I use now:
IF LOAD # katana sysex message template in L00 to L0E # L00 to L09 = fixed, L0A to L0B = param, LC = val # LD = checksum, LE = end of sysex # L0 L1 L2 L3 L4 L5 L6 L7 L8 L9 LA LB LC LD LE ASS L0 = F0 41 00 00 00 00 33 12 60 00 00 00 00 00 F7
# L80 = flag if incoming message match # L81 = flag if to block original event ASS L80 = 0 0 END
# assume no match and no block ASS L80 = 0 0
# handle incoming katana sysex messages IF M0 == L0 L1 L2 L3 # roland sysex IF M6 == L6 L7 L8 # katana
# convert fx1/31hz to fx2 IF MA == 01 70 # flag to send and block ASS L80 = 1 1
# set fixed param (fx2/21hz) ASS LA = 03 7C
# copy value (always use M0C and never MC here) ASS LC = M0C END
# ... do similar katana sysex conversions here. eg: # (see explanatory notes below) # IF MA == 03 70 # ASS L80-81, LA-LC # END END END
# handle other (non katana sysex) incoming events IF M0 == B0 14 ASS L80 = 0 1 M2 END
# optionally convert fx1/31hz to fx2 IF MA == 01 70 IF L82 == 0 # fx1 (CC20) is active # don't send katana message and don't block ASS L80 = 0 0 END
IF L82 != 0 # fx2 (CC20) is active # send L0-E katana message and block original ASS L80 = 1 1
# convert fx1/31Khz to fx2 ASS LA = 03 7C M0C END END
# ... more CC events (similar clauses to above)
# post match processing # if L80 == 1 then we matched, so send # correct katana sysex stored in L0 IF L80 == 1 # calculate checksum of L8-LC (into LD) ASS LD = L8 MAT LD = LD + L9 MAT LD = LD + LA MAT LD = LD + LB MAT LD = LD + LC MAT LD = LD % 80 MAT LD = 80 - LD IF LD == 80 ASS LD = 0 END
# send the message SND L0 L1 L2 L3 L4 L5 L6 L7 L8 L9 LA LB LC LD LE END
# if L81 == 1 then block incoming event IF L81 == 1 XX = XX +B END
|
|
|
Post by gurbz on Jul 15, 2019 17:02:30 GMT
So I will take a crack at more sysex data to handle, I read something about ranges in the streambyter university pages. I’ll be back🤨
|
|
|
Post by gurbz on Jul 15, 2019 17:24:31 GMT
Do you advise to copy and paste it this way? The sliders both work.
IF LOAD # katana sysex message template in L00 to L0E # L00 to L09 = fixed, L0A to L0B = param, LC = val # LD = checksum, LE = end of sysex # L0 L1 L2 L3 L4 L5 L6 L7 L8 L9 LA LB LC LD LE ASS L0 = F0 41 00 00 00 00 33 12 60 00 00 00 00 00 F7
# L80 = flag if incoming message match # L81 = flag if to block original event ASS L80 = 0 0 END
# assume no match and no block ASS L80 = 0 0
# handle incoming katana sysex messages IF M0 == L0 L1 L2 L3 # roland sysex IF M6 == L6 L7 L8 # katana
# convert fx1/31hz to fx2 IF MA == 01 70 # flag to send and block ASS L80 = 1 1
# set fixed param (fx2/21hz) ASS LA = 03 7C
# copy value (always use M0C and never MC here) ASS LC = M0C
# convert fx1/31hz to fx2 IF MA == 01 71 # flag to send and block ASS L80 = 1 1
# set fixed param (fx2/21hz) ASS LA = 03 7D
# copy value (always use M0C and never MC here) ASS LC = M0C END END
# ... do similar katana sysex conversions here. eg: # (see explanatory notes below) # IF MA == 03 70 # ASS L80-81, LA-LC # END END END
# handle other (non katana sysex) incoming events IF M0 == B0 14 ASS L80 = 0 1 M2 END
# optionally convert fx1/31hz to fx2 IF MA == 01 70 IF L82 == 0 # fx1 (CC20) is active # don't send katana message and don't block ASS L80 = 0 0 END
IF L82 != 0 # fx2 (CC20) is active # send L0-E katana message and block original ASS L80 = 1 1
# convert fx1/31Khz to fx2 ASS LA = 03 7C M0C END END
# optionally convert fx1/31hz to fx2 IF MA == 01 71 IF L82 == 0 # fx1 (CC20) is active # don't send katana message and don't block ASS L80 = 0 0 END
IF L82 != 0 # fx2 (CC20) is active # send L0-E katana message and block original ASS L80 = 1 1
# convert fx1/31Khz to fx2 ASS LA = 03 7D M0C END END # ... more CC events (similar clauses to above)
# post match processing # if L80 == 1 then we matched, so send # correct katana sysex stored in L0 IF L80 == 1 # calculate checksum of L8-LC (into LD) ASS LD = L8 MAT LD = LD + L9 MAT LD = LD + LA MAT LD = LD + LB MAT LD = LD + LC MAT LD = LD % 80 MAT LD = 80 - LD IF LD == 80 ASS LD = 0 END
# send the message SND L0 L1 L2 L3 L4 L5 L6 L7 L8 L9 LA LB LC LD LE END
# if L81 == 1 then block incoming event IF L81 == 1 XX = XX +B END
|
|
|
Post by gurbz on Jul 16, 2019 4:41:26 GMT
Getting the hang of it, copy and paste while using a loptop this tjme.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jul 16, 2019 9:30:35 GMT
Hi gurbz , If you use the 'C' button in the board editor (4th button from right) to insert a code block, then the indents are preserved which makes code much easier to read. So, I have reworked your code, which had a bit of duplication of the IF statements into something more simpler. Hopefully you can understand what I have done. To remap the other parameters from fx1 to fx 2 you just need 3 lines per mapping IF LOAD # katana sysex message template in L00 to L0E # L00 to L09 = fixed, L0A to L0B = param, LC = val # LD = checksum, LE = end of sysex # L0 L1 L2 L3 L4 L5 L6 L7 L8 L9 LA LB LC LD LE ASS L0 = F0 41 00 00 00 00 33 12 60 00 00 00 00 00 F7
# L80 = flag if incoming message match # L81 = flag if to block original event ASS L80 = 0 0 END
# assume no match and no block ASS L80 = 0 0
# handle incoming katana sysex messages IF M0 == L0 L1 L2 L3 # roland sysex IF M6 == L6 L7 L8 # katana
IF L82 != 0 # fx2 translation (CC20) in effect # flag to send and block ASS L80 = 1 1
# convert eq1 to fx2 IF MA == 01 70 ASS LA = 03 7C M0C END
# convert eq2 to fx2 IF MA == 01 71 ASS LA = 03 7D M0C END
# add more fx1 to fx2 mappings here # you need 3 lines for each mapping # like above END END END
# handle other (non katana sysex) incoming events IF M0 == B0 14 ASS L80 = 0 1 M2 END
# post match processing # if L80 == 1 then we matched, so send # correct katana sysex stored in L0 IF L80 == 1 # calculate checksum of L8-LC (into LD) ASS LD = L8 MAT LD = LD + L9 MAT LD = LD + LA MAT LD = LD + LB MAT LD = LD + LC MAT LD = LD % 80 MAT LD = 80 - LD IF LD == 80 ASS LD = 0 END
# send the message SND L0 L1 L2 L3 L4 L5 L6 L7 L8 L9 LA LB LC LD LE END
# if L81 == 1 then block incoming event IF L81 == 1 XX = XX +B END
Now, you could in theory be smarter with the fx1 to fx2 mappings if there is a mathematical method of mapping or you could create a lookup table. However, I think it might be easiest to just replicate those 3 lines per parameter? Regards, Nic.
|
|
|
Post by gurbz on Jul 16, 2019 13:23:37 GMT
I ‘ll try it! I started copying and pasting and that already went fast, this is even better. There could a mathematical pattern, I ‘ll look into it as minimizing code is part of the game.
|
|
|
Post by gurbz on Jul 16, 2019 13:44:32 GMT
Nic: it is possible that adding 524 (decimal) to the FX 1 results in FX2. So Sysex adress 01 70 becomes 03 7C bij adding $524 (hex 20C)
I random checked this with 3 fx1-fx2 values and that worked. (I think it goes south for a few effects but a lot of values work.)
|
|
|
Post by gurbz on Jul 16, 2019 21:17:40 GMT
But: copy and pasted 30 controls within 15 minutes with the rewritten code, only 3 lines works like a charm👍🏻👍🏻
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jul 17, 2019 8:12:32 GMT
Hi gurbz , I suspected the 3 line trick would be sufficient, but for completeness, here's how to add hex 10C converting between 2 x 7bit and 1 x 14bit values: (note I make the difference 10C not 20C when using 14 bit values) # remap to fx2 using 7/14 bit math # add 10C to MA/MB into LA/LB MAT I0 = MA * 80 MAT I0 = I0 + MB MAT I0 = I0 + 10C MAT LA = I0 / 80 MAT LB = I0 & 7F ASS LC = M0CIn theory, you could do this first and replace all of those 3 line IFs with this where the +10C rule holds. Where the +10C rule does not hold, use a 3 line IF to override with correct value. Regards, Nic.
|
|
|
Post by gurbz on Jul 17, 2019 8:14:49 GMT
Hahaa! Gonny try that one also. Thanks man!
Dutch proverb: "Boter bij de Vis"
|
|