How do you achieve knob threshold

Tony Hulten

2016-04-12 22:13:48

Hi,

I have knobs that sends
xx xx 3F when turning left
xx xx 41 when turning right

I'm looking for any insight on how to achieve some kind of threshold so that nothing happens until a knob is turned 2 steps.
So in simple terms I want some kind of rule that say: If you receive just one xx xx 37 or xx xx 41 within a period of 200ms, then SKIP outgoing action

Any help is appreciated :)

Cheers

gabriels

2016-04-14 23:47:14

This may be overly complicated, but ought to work:
Create a two presets (Preset 1 and Preset 2)
-Preset 1 is enabled at the start.
-Preset 2 is disabled (unchecked) at the start.

Preset 1 has three translators (the input for Translators 1 and 2 is the 3Fh or 41h from your controller):
- Translator 1 has two functions-
-----When it receives either 3Fh or 41h It starts a 200ms timer
-----It also uses a rule to increment a global variable - for example "ga". This variable will by default have an initial value of 0.
- Translator 2, when it receives 3Fh or 41h enables
- Translator 3 receives input from the timer (not 3Fh or 41h from your controller)
----- When the timer "fires" this translator enables the Preset 2 (described below).

Preset 2 receives 3Fh or41h from your controller.
- As described, this preset is disabled (unchecked) originally.
- This preset contains a translator whose output executes your desired action, but before it does that:
-----It uses a rule to increment variable "ga" upon receiving 3Fh or 41h from your controller.
-----Another rule allows it to execute the desired action if "ga" is exactly 2.
-----Another rule disables Preset 2 if "ga" is exactly 2
-----Another rule resets "ga" to 0 if it has incremented to 2.

I'm not sure if your intention is that you'd get repeated actions if you receive more than 2 inputs from your controller within 200ms. If so, you could change the rules. Also, there might be a problem if you rapidly send 3F and then 41 or vice versa. Again, you could figure out rules to handle that.

All in all, this seems clumsy. I suspect there's an easier way, but I think it may work (with a bit of fiddling around)
Gabriel

gabriels

2016-04-14 23:50:45

ooops
- Translator 2, when it receives 3Fh or 41h enables
should read thusly:
- Translator 2, when it receives 3Fh or 41h enables Preset 2.

Tony Hulten

2016-04-15 15:55:22

Thank you so much gabriels!

In general it supposed to work like this:
You turn a knob and the mouse goes to certain x/y positions, clicks and holds button and drags mouse either left/right or up/down (depending on what you programmed it to do when you turn the knob) when you stop turning the knob for a certain amount of time to go back to the start x/y position.
I need the knobs to be able to take a beating like he says in the next video. To turn the knobs back and forth and and react in a responsive manner.
(https://youtu.be/UdEOO6F-JuI?t=39s)

I achieved most of this with help of DvisAdvt but its the threshhold thing I need to figure out :)

Im gonna play around with the information you have lent me. Im new to all this so it helps to talk to me like im a baby :)

btw in preset 1, why would I want tanslator 2 to activate the preset 2 to have translator 3 (via timer) to do the exact same thing? Im sure im missing something

gabriels

2016-04-16 23:22:46

Tony,
Sorry...I made a mistake in my suggested program, and an omission.
- The error is that the timer, when it fires, will disable Preset 2, not enable it.
- The omission is that you would need to prevent translator from repeating its actions if it receives more than one input from the controller.
Also, my program would only have allowed one action within the 200ms window, so I changed that

It will probably be easier to understand if I put the program in the form I've seen here in the forum - namely, to list the program itself... so here goes a corrected version in a better format.

Now that I understand your needs better, I see that the intended actions are more complex than I first thought...so what I'm presenting here is only a skeleton upon which you can hang the necessary actions. Not necessarily a simple task.

Disclaimer: I'm obviously not a programmer... There's probably an easier way, and my program may be faulty, but it's a start, and I bet it would work with a bit of effort put into refining it.

Notes:
- Global variable ga will be 0 by default, when you launch the program.
- Input from the knob is assumed to be from Controller #1 on Channel 1 for purposes of my program.
- 3F hex from the knob = 63 decimal
- 41 hex from the knob = 65 decimal
- Preset "Phase Two" must be disabled (unchecked) initially
_________________________________________________________________________________________________
Preset 1 (Phase One) - Translator 0
Incoming:
Midi B0 01 oo

Rules:
if oo==63 then skip next rule
if oo!=65 then exit rules, skip Outgoing Action
//after executing the following, ga will equal 1. ga will need to =2 for an output action to happen.
ga=ga+1
exit rules, execute Outgoing Action

Outgoing:
Timer
Timer Name:
200 MILLISECOND TIMER
Once
Initial Delay: 0
Delay: 200 milliseconds
_________________________________________________________________________________________________

Preset 1 (Phase One) - Translator 1
Incoming:
Midi B0 01 oo

if oo==63 then skip next rule
if oo!=65 then exit rules, skip Outgoing Action
exit rules, execute Outgoing Action

Outgoing:
Preset Change
Activate by name Phase Two
_________________________________________________________________________________________________

Preset 1 (Phase One) - Translator 2
Incoming: Timer 200 MILLISECOND TIMER
Outgoing:
Preset Change:
Deactivate by name Phase Two
_________________________________________________________________________________________________

Preset 2 (Phase Two):
if oo==63 then skip next rule
if oo!=65 then exit rules, skip Outgoing Action
ga=ga+1
if ga!=2 then exit rules, skip Outgoing Action
ga=0
exit rules, execute Outgoing Action

//Notes:
//The output of this translator would contain your desired action(s). It looks as if you'll need to
//add more presets for the output, since your desired actions are more complex than it seemed at first glance.
//I just have a mouse movement to an arbitrary position (x=100, y=100) for starters.
//You'll probably have to test different delay amounts. 200ms may be too long.


Gabriel

Tony Hulten

2016-04-17 02:30:39

Nice Gabriel!
Really appreciate you taking the time to help me out :D
From your first answer I still managed to create something of a threshold. But I would not call it good, Im just a little slow at this :mrgreen:
But it was better then nothing. I will dedicate tomorrow to try again now that you have given me this valuble information. Im really new to this but by looking at your explanation it looks to make sense.

Many thanks

Tony Hulten

2016-04-17 15:57:21

Works perfect!
Thank you once again gabriels!

gabriels

2016-04-17 20:48:50

I've certainly gotten support through this forum many times, so I'm glad to have helped.
Gabriel

dermot shane

2016-05-04 19:36:26

i am using Tony's template and found it very easy to change x/y cordnates to map to my 1920x1080 UI screen, but now wish to go a bit further and map the x/y to a diffrent place on the UI to land on each of the nine RGB|LGG controls, and then move the mouse verticaly

i already have alot of the things in Tony's mapping covered by another control surface (Euphonix Artist Color), but do not, and cannot have RGB|LGG mapping on that tool

i'm not sure in Tony's script where the horiziontal -vs- vertical mouse movement is set, or if there is more to it than that?

Any help would be appreacated, i'm pretty booked with client atended sessions and do not have alot of downtime to try things out!

dermot shane

2016-05-15 21:57:18

on this file i posted to the orignal thread, but perhaps it's better to ask here...
DvlsAdvct wrote:Alright, so there are a bunch of things going on here, and we have to approach them one at a time.
<snip>
I put together a project for one command. Just change the default input port and see if this works for you.

There's logic to it, so if it works let me help walk you through how the variables all work.
Thanks
J
Jared / Tony / anyone who can help;
i am using Tony's settings with x/y changed to suit my screen, and now would like to modify the horziontal movement, and change nine of the mouse movements to vertical, I downloaded the "mouse movement.bmtp and opened it in a text editor, and see the following lines;
Name3=Mouse Right
Incoming3=MID3<Incoming Action="MIDI"><Simple Type="ControlChange"><Channel num="0"/><Value1 num="0x00"/><Value2 num="0x01"/></Simple></Incoming>
Outgoing3=Mse100000F0000
Options3=Actv01Stop00OutO01StMa00000001if(g0!=2)noexecute

Name4=Mouse Left
Incoming4=MID3<Incoming Action="MIDI"><Simple Type="ControlChange"><Channel num="0"/><Value1 num="0x00"/><Value2 num="0x7F"/></Simple></Incoming>
Outgoing4=Mse100FFF10000
Options4=Actv01Stop00OutO01StMa00000001if(g0!=2)noexecute
i am guessing the outgoing actions are the lines to be looked at? if so what are the values that need to be changed to create vertical mouse movement? should note that i am currently seeing a diagonal mouse movement, not stright horiziontal

many thanks in advance for any help!

DvlsAdvct

2016-05-16 15:23:18

Hi dermot

The problem is that the up and down messages are probably triggering on the same MIDI CC message. Make sure that they respond to different ones so you have to turn one knob to go up and down, and another to go left and right. I don't have the project open in front of me, but that would be my guess.

Jared

dermot shane

2016-05-16 16:16:46

The problem is that the up and down messages are probably triggering on the same MIDI CC message. Make sure that they respond to different ones so you have to turn one knob to go up and down, and another to go left and right. I don't have the project open in front of me, but that would be my guess.
no problem haveing dedicated knobs for vertical and horiziontal movement, that would be my prefrence

what do not know or understand is how the outgoing line realtes to mouse movement, and therefore how to change it ;-)

currently outgoing message "Outgoing3=Mse100000F0000" moves the mouse diagonaly right, and "Outgoing4=Mse100FFF10000" moves the mouse pointer diagonaly left

how does one edit "Mse100FFF10000" and "Mse100000F0000" to make the mouse move verticaly? what is the relationship between the Mse line and the mouse movement on screen?

DvlsAdvct

2016-05-17 22:54:42

Can you open the project in MT Pro, instead of notepad, and see how the translators are structured? That should make more sense.

dermot shane

2016-05-18 19:07:21

Jared;
my machine is super busy, booked 16hr/day, 7days/week.. so my time to play with MT is very limited untill mid June at the very soonest, and text editor on my laptop seemed like the best option to look at the options.

If/ when i get a chance i'll try again, but again, and mainly so i'm not digging through a haystack looking for a single needle.. how/what is the realtionship between the output line, and the mouse movement? where do i find that?

DvlsAdvct

2016-05-18 19:35:24

I don't usually review translators in text editors. I'll open one up when I get home and see how the code is structured and let you know. My assumption is that Mse100000F0000 is right and Mse100FFF10000 is left, but since this thread doesn't have any reference to the work that was being done with the mouse movements I can't compare to what was being provided. Is there a different thread that has that information?

I understand the machine is in use.

Jared

florian

2016-06-03 09:13:43

I see no way of affecting this either in the software or in text edit, and can not find any tutorials or any information really about anything to do with programing these movements - can you please help to explain how to change the logic, and how to change horiziontal to vertical?
I try as simple as I can:
  1. start MIDI Translator Pro
  2. open the .bmtp file from Tony
  3. Select the first preset in the left list. In the center list you'll see the translator entries.
  4. click (or double click the first time) a translator entry and see its properties in the right side bar
  5. in the side bar, scroll to the bottom to see the Outgoing Action
  6. if the Outgoing Action's type is "Mouse", you can edit the behavior of that translator.
  7. select the next translator and/or preset and repeat steps 4-6.
I cannot find the .bmtp file anywhere. Could you please attach it here?
THanks,
Florian

dermot shane

2016-06-06 20:42:43

thank you Florian!

i had a few min to test Bome + Twister this morning, and have attached two screen caps from my system... what you see here is Bome open over top of Davinci Resolve's UI, the values i want to control are the nine vertical sliders marked Red/Green/Blue - Lift /Gamma/Gain.

i am able to load Tony's template, re-name and modify some of the CC knobs to have the mouse land where i want it to, that part seems to be working well;
DavinciResolve1.jpg
DavinciResolve1.jpg (141.37 KiB) Viewed 5941 times
but where i am running into a road block is getting the mouse to move verticaly, currently under Tony's preset it is moveing in zig-zag manner upwards no matter what direction i turn the matching knob on Twister, so i can increment values positivly only, and also will trigger sliders in the ui next to the one i wish to address as the mouse movement makes it way upwards and sideways across the ui like a drunken football lout at 4am... not the desired effect at all...
if the Outgoing Action's type is "Mouse", you can edit the behavior of that translator.
when i try to locate where the options are for mouse movement i cannot find anything that will change the behavior, i have vertical selected, can you help point out where i can edit this?
DavinciResolve2.jpg
DavinciResolve2.jpg (137.64 KiB) Viewed 5941 times
thank you for the time and expertise, i cannot locate any tutorials or a manual that addesses these functions so your help is very valuable
Attachments
Resolve_freshtea_midi_OFFICAL.bmtp
(30.86 KiB) Downloaded 187 times

florian

2016-06-07 11:28:17

Hi Dermot,
this is quite a complex MIDI Translator project! Not really suitable for learning how to use MT Pro... It's somewhat difficult for me, too, to understand what exactly is going on (also considering that I don't know Davinci and don't have a Twister here).

What I can see in the preset "COLOR KNOBS", assuming you turn knob 1 (C01) by one notch:
  1. the incoming MIDI message will first trigger [2]Contrast_C01. In the Rules section, it will set the variable g0 to 1 (probably meaning: "mouse positioned"). And do some other logic with ga which I don't know what it serves.
  2. The same MIDI message from the knob will also trigger [22]MouseRight and [23]MouseLeft, but the Rules prevent them from being executed, because g0 is set to 1.
  3. Now that same MIDI message will trigger [24]LeftClick. In the Rules, it will set g0 to 2 (I guess "mouse button down") and execute the outgoing action: press down the left mouse button (at the current mouse position). Btw, I believe there is a small bug here.*)
  4. Now the MIDI message reaches [25]ClickTimer. Because g0 is 2, it will set gb to 1 (I guess meaning "timer started") in the Rules and then start a timer "Mouse Up" which will fire in 175ms.
  5. [26]KillTimer will set gb to 2.
  6. [27]ClickTimer is not executed because gb equals 2.
Now turning that knob to the right, it will execute [22]MouseRight, dragging the mouse 2 pixels to the right. It says "mouse move", but the mouse button is already pressed from step 3 above. Translator [25] will refresh the timer, so it starts another 175ms period. Turning the knob in the other direction will trigger [23]MouseLeft.

If you wait for 175ms (i.e. no knob movement for that period), the "Mouse Up" timer will be fired by MIDI Translator Pro, and translator [28]ClickTimer will be executed. It will reset ga and gb to 0, and stop release the left mouse button.

There is some more functionality, e.g. knob 14 will emulate pressing the left and right cursor keys on the computer keyboard.

Now to change the horizontal dragging, I believe it's sufficient to modify [22] (and [23]) to not move 2 (-2) pixels to right (left), but to 2 (-2) in Down/Up direction. Put a 0 into Left/Right direction.

Thanks,
Florian

*) in translator [24], the first IF statement will cause the outgoing action (mouse button press) to be executed whenever g0 is not 1. So whenever you turn a knob by one notch, the mouse button is pressed down again. I believe that the button press should only occur if g0 is 1 (i.e. the mouse has just been positioned). So the Rules section should be this only to prevent double presses:

Code: Select all

if g0!=1 then exit rules, skip Outgoing Action
g0=2
Also, I believe that [26] always eliminates [27]: [26] sets gb to 2, and [27] is not executed if gb is 2. So you can safely remove/disable [27]. Maybe the entire "gb" logic can be removed.
Furthermore, version 1.8 introduced the feature to position the mouse and immediately press down, too (use button click with position). So the preset's logic could be simplified by using this combined outgoing action in the mouse positioning translator [2] to [18] and removing [24].

Tony Hulten

2016-06-07 12:15:19

Hi everyone, Im not a 100 im correct in this but should it look something like this?
Attachments
Sketch.jpg
Sketch.jpg (483.51 KiB) Viewed 5939 times

dermot shane

2016-06-08 08:03:34

thanks so much Florian and Tony!!!

my suite is once again booked around the clock until next weekend, so it will be a few days before i can get back to this project

one thing tho, i also want to keep some of the horiziontal functions (tint/temp/CB/MD/highlights/shadows)

so is the best thing to add another two line ie; 30 & 31 for vertical?

Tony Hulten

2016-06-08 22:17:48

Dermont at the moment im fully booked too but im going to try to see if I can get it to work next week hopefully :)