I’m having trouble programming basic fader/knob

I want to basically program a fader to…

PP<65 keystroke X incrementally faster
PP>65 keystroke Z incrementally faster

Also…
How do I program a button when held down, it holds the key stroke z down
Example
Exam: holding z on my keyboard zooms

Hi, please find the below project file.

I set my incoming controller alias as follows:

You can learn more about aliases from this tutorial.

Translator 1.0 does most of the heavily lifting with the rules of that translator. Here are the rules with comments. I also added log messages so that you can see what is happening.

Log "incoming value = %qq%"
// qq will determine the rate
tt=64-qq
// scale it the same in both directions
rr=0
if tt<64 then rr=1
// make it always positive range should be from -64 to + 64
if tt<0 then tt=tt*-1
tt=tt+rr
// convert it to milliseconds
tt=tt*1000
tt=tt/64
// reverse because larger delta should be smaller delay
tt=1000-tt
// stop timer if between 62 and 66
if qq<63 then skip next rule
if qq<67 then Goto "Stop"
// ga = stop flag 0= stop timers 1= timer running
ga=1
// direction flag
if qq>64 then rr=1
if qq<64 then rr=-1
Log "Log rate in milliseconds = %tt% direction = %rr%"
Perform "key", tt,rr
exit rules, execute Outgoing Action
Label "Stop"
Perform "stop"
// ga = stop flag 0= stop timers 1= timer running
ga=0


Translators 1.1 and 1.2 start the X Timer and Z Timers respectively. The parameters passed to them set the keystroke speed of the repeating timers which translators 1.3 and 1.4.

Translators 1.5 and 1.6 stop the repeating timers.

In rules of translator 1.1 I set it up so that you have a little wiggle room to stop both timers if your CC doesn’t land exactly on 64. I picked 64 instead of 65 as the center position as that is the mid point between 0 and 127. I set it up for between 63 and 66 to stop the timers.

The keystrokes will be sent to the application that is in focus.

See translators 2.0 and 2.1

Key-X-or-Z with incoming CC.bmtp (4.3 KB)

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

Thanks again, Steve.