Tolerance from +-1% by takeover

MikeDoor

2019-12-01 04:58:09

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

Steve-Bome Forum Moderator

2019-12-01 08:58:22

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

MikeDoor

2019-12-01 12:34:02

comment

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

Steve-Bome Forum Moderator

2019-12-01 18:07:29

comment

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”

MikeDoor

2019-12-01 18:30:24

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:

ToleranceTakeover.bmtp

Steve-Bome Forum Moderator

2019-12-01 19:08:35

comment

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).

MikeDoor

2019-12-01 20:27:08

comment

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.

MikeDoor

2019-12-01 20:29:03

comment

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

Steve-Bome Forum Moderator

2019-12-01 20:35:48

comment

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.

Steve-Bome Forum Moderator

2019-12-01 20:56:20

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:

MIDI-Mix-Multi-Channel-Takeup-Example-2019-12-01.bmtp

MikeDoor

2019-12-01 21:31:17

comment

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?

MikeDoor

2019-12-01 21:42:31

comment

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?

Steve-Bome Forum Moderator

2019-12-01 21:50:07

comment

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

MikeDoor

2019-12-01 22:02:18

comment

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?

MikeDoor

2019-12-01 22:07:49

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?

Steve-Bome Forum Moderator

2019-12-01 23:12:46

comment

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.

Steve-Bome Forum Moderator

2019-12-01 23:26:44

comment

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

MikeDoor

2019-12-02 00:27:58

comment

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