Tolerance from +-1% by takeover

Hey Steve,

 

have a question to put a +-1% tolerance by making a takeover?

Example:

Channel 1 Knob 1:

vv=0 tt=zz>>vv tt=tt&1 if tt==0 then Goto "done" rr=gz&127 qq=qq if rr==qq then tt=1<<vv if rr==qq then tt=tt^-1 if rr==qq then zz=zz&tt uu=0 if rr!=qq then exit rules, skip Outgoing Action

Label “done”
ss=127<<0
ss=ss^-1
gz=gz&ss
gz=gz|qq
g0=gz

Channel 2 Knob 1:

vv=0
tt=zz>>vv
tt=tt&1
if tt==0 then Goto “done”
rr=gz&127
qq=qq
if rr==qq then tt=1<<vv
if rr==qq then tt=tt^-1
if rr==qq then zz=zz&tt
uu=0
if rr!=qq then exit rules, skip Outgoing Action

Label “done”
ss=127<<0
ss=ss^-1
gz=gz&ss
gz=gz|qq
g1=gz

Sometimes have to rotary the knob in mm bothsides to pick the value after channel change. Would be nice to get fixed this in a way.

Kindest regards
Mike

Well I will show some sample code. You can take it here and apply it to your situation

// incomming is qq
// going to compare to ga
// if qq is within +1% or -1% of ga then take no action
// knob being 0-127 so 1% is 1.28 or 1
// otherwise set ga to qq
// figure out 1% change next line to 2*128 for 2 percent
// etc - Presision is not that accurate
tt=1*128
tt=tt/100
// if qq> (ga-tt) and qq < (ga+tt) then ss=1
// Default is true ss=1
// Upper Limit rr=ga+tt
// set to false for qq>ga+tt
if qq>rr then ss=0
// Lower limit
rr=ga-tt
// set to false for qq<ga-tt
if qq<rr then ss=0
// If still 1 here then both conditions must be true
if ss==1 then goto \"skip\"
// Adjust value since it is outside range
ga=qq
goto \"done\"
label \"skip\"
// must be inside range
exit rules, skip outgoing action
label \"done\"
// will default to execute outgoing action

 

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

Hey Steve,

thanks a lot for this. But after some rotate attempts, didn`t runs correct.
I get no reaction “MIDI controller Knob gets no signal” or the knob is still on value 0.

I didn`t make copy paste I have fill the variables on there places, but this didn`t run to.
I do not understand what from your samples is build together and didn`t runs without a rule.

I think I have understand the 1% tolerance in variables, found a similar one on another forum, but I can`t figure it, specially with this project.

Kindest reagards
Mike

OK so if it is 0 or 127 we always want it to execute. Add the below:

// Always true for 127 and 0
if qq==0 then ss=0
if qq==127 then ss=0

Just before
if ss==1 then goto “skip”

I get only a red lines:
by if ss==1 then goto “skip”

and some other stuff which I`ve tried before.

skip outgoing action didn`t work too.
I`ve add the sample file.
There you can see, that nothing from the option work correct on this file.
Can`t understand why this will not run.

 

Could you make an example on the file below please. I wanna understand to add this step correct to the mapping.

 

kindest regards

Mike


Attachments:
1575221273906_ToleranceTakeover.bmtp

Are you doing this with the MIDIMIX? If so your Channel 1 preset does not include input from MIDI MIX.
If you are doing this with your APC 40, you do not need takeover mode since they are soft encoders. (you can set them remotely).

No, I do it with my APC40 MKII. I need to do the tolerance, because if I change the saved value, it goes 1 value +- when have to go back -+ to take the value. I want use it directly not with the light rotary to pick the point.
I use the Mode 2 and programmed the whole bitmapping for the mode 2 so I have to do the +-1 tolerance to let it run clearly.

BTW, I don`t use it in Ableton, so I can`t set this remotely…

When you switch channels on APC40, just capture the last known value of the encoder. When you switch back, then just have MT Pro send back the value you captured when switching away.
Basically on APC40 you can set the encoders from MT Pro to any value you want when switching channels so you don’t need takeover on that unit.

See attached.

Translator 3.1 has your range calculations. I only did it for that knob.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz


Attachments:
1575230171807_MIDI-Mix-Multi-Channel-Takeup-Example-2019-12-01.bmtp

On that knob it runs correct on both channels. Now, if I make it with 2 more knobs, it comes with random values.
Can I use this sample with my bitmapping to runs correct? Or did I have to be careful with writting the map? I think there`s another thing I have to change, if I use it on another channels.
For example: For the Faders I have to open the qq=qq right?

If you look at my two Channel variables above with the whole rules.
Some ss and rr from me are on the opposite from that what you wrote.
Maybe that would be the false run?

Each channel/knob has it’s own bit map

global variable zz is the bitmap to determine which knobs have been touched on the new channel.
Global variable gz, is the temporary bitmap for the current channel when switching channels. This get populated with the OnActivation Preset for each channel. You have to return to the permanent variable in your translators (last line)

You should be able to replace everything from //”tolerance calculation” to “Label done” in the new rules (11 rules) with everything from “//Now look” to “Label Done” in the old rules (4 rules).

Everything there should be local variables so you should be safe.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

I think it`s a problem with the bit position. Normally this should be added in this script to right?
We did on the second knob column 1 the vv=1 and rr=gz>>7
So my script has:
rr and ss in different usage as yours. That would be means. The tolerance variable ss should be converted to rr on my script right?

And where`s the last known value saved?
if rr==qq then tt=1<<vv
if rr==qq then tt=tt^-1
if rr==qq then zz=zz&tt
uu=0
if rr!=qq then exit rules, skip Outgoing Action
This should be to need or not?

This is needed. The global variable zz is a bitmap to determine which knobs need to be in takeover mode and which do not. ZZ gets set when channing channels and when you go out of takeover mode, the bit for that knob is cleared.

You can use any local variables within the translators and they won’t interfere with any other ones. You have
oo,pp,qq,rr.,ss,tt,uu,vv,ww and xx to work with. Just make sure that if you are still using a global variable you don’t re-use it within the translator until you are done with it.

Pick any unused local variables in place of the ones I used and it should work.

I`ve got it! I`ve did 3 percent and add the tolerance script before the last saved point and tried out if this runs without problems.
Thank you so much for your amazing help aswell Steve!
Appreciate it so much.

Kindest regards
Mike