use midi knobs for continuous output

wouter0102

2016-12-18 14:07:15

Hello, I'm a real newby to using the rules and the whole bome midi translator software so keep that in mind please.

So what I would like to do is to create a translator so that when my knob is in the middle position nothing happens but when I turn it left the mouse keeps going left, and the more I turn the knob left the faster it goes vice versa for right.

Another thing I would like to do is that same function but the mouse jumping back to the starting position so it keeps repeating that until I put it back in the middle position.

All ideas are welcome thank you up front.

florian

2016-12-19 10:33:43

Hi wouter0102,
all this is definitely possible with MT Pro.
Is this an encoder knob (endless) or a controller knob? Does it have a defined middle position? Which MIDI device is it?

Can you please do this:
  • in MT Pro, go to the project properties, MIDI INPUT list, and enable or double-click your MIDI device with the knob so that its state is "open"
  • open the Log Window (e.g. from the View menu), check all options there, i.e. MIDI IN and Timestamped.
  • put the knob into the center position
  • rotate the knob to left slowly, then faster
  • same for rotating to the right
The select all and copy/paste the content of the Log Window here into the forum. Then we can see how to create your mapping for mouse emulation.

Are you on Windows or Mac?

Best,
Florian

wouter0102

2016-12-19 11:42:02

florian wrote:Hi wouter0102,
all this is definitely possible with MT Pro.
Is this an encoder knob (endless) or a controller knob? Does it have a defined middle position? Which MIDI device is it?

Can you please do this:
  • in MT Pro, go to the project properties, MIDI INPUT list, and enable or double-click your MIDI device with the knob so that its state is "open"
  • open the Log Window (e.g. from the View menu), check all options there, i.e. MIDI IN and Timestamped.
  • put the knob into the center position
  • rotate the knob to left slowly, then faster
  • same for rotating to the right
The select all and copy/paste the content of the Log Window here into the forum. Then we can see how to create your mapping for mouse emulation.

Are you on Windows or Mac?

Best,
Florian
First of all my device is an akai lpd8 and it's not an endless encoder it has hard stops the range is 0-127 and in the middle it is 64 the value ... and I really don't know if it has a defined middle position but I don't actually think so. And I'm running it on a windows ;)

So I did exactly as you said and got this for turning left:

Code: Select all

272504 - MIDI IN [LPD8]: B0 07 3F
272547 - MIDI IN [LPD8]: B0 07 3E
272586 - MIDI IN [LPD8]: B0 07 3D
272618 - MIDI IN [LPD8]: B0 07 3C
272687 - MIDI IN [LPD8]: B0 07 3B
272718 - MIDI IN [LPD8]: B0 07 3A
272749 - MIDI IN [LPD8]: B0 07 39
272786 - MIDI IN [LPD8]: B0 07 38
272820 - MIDI IN [LPD8]: B0 07 37
272843 - MIDI IN [LPD8]: B0 07 36
272866 - MIDI IN [LPD8]: B0 07 35
272883 - MIDI IN [LPD8]: B0 07 34
272918 - MIDI IN [LPD8]: B0 07 33
272931 - MIDI IN [LPD8]: B0 07 32
272940 - MIDI IN [LPD8]: B0 07 31
272948 - MIDI IN [LPD8]: B0 07 30
272954 - MIDI IN [LPD8]: B0 07 2F
272960 - MIDI IN [LPD8]: B0 07 2E
272966 - MIDI IN [LPD8]: B0 07 2D
272975 - MIDI IN [LPD8]: B0 07 2C
272980 - MIDI IN [LPD8]: B0 07 2B
272985 - MIDI IN [LPD8]: B0 07 2A
272990 - MIDI IN [LPD8]: B0 07 29
272993 - MIDI IN [LPD8]: B0 07 28
272997 - MIDI IN [LPD8]: B0 07 27
273001 - MIDI IN [LPD8]: B0 07 26
273005 - MIDI IN [LPD8]: B0 07 25
273008 - MIDI IN [LPD8]: B0 07 24
273016 - MIDI IN [LPD8]: B0 07 23
273020 - MIDI IN [LPD8]: B0 07 22
273024 - MIDI IN [LPD8]: B0 07 21
273029 - MIDI IN [LPD8]: B0 07 20
273034 - MIDI IN [LPD8]: B0 07 1F
273038 - MIDI IN [LPD8]: B0 07 1E
273043 - MIDI IN [LPD8]: B0 07 1D
273050 - MIDI IN [LPD8]: B0 07 1C
273055 - MIDI IN [LPD8]: B0 07 1B
273058 - MIDI IN [LPD8]: B0 07 1A
273060 - MIDI IN [LPD8]: B0 07 19
273064 - MIDI IN [LPD8]: B0 07 18
273067 - MIDI IN [LPD8]: B0 07 17
273070 - MIDI IN [LPD8]: B0 07 16
273073 - MIDI IN [LPD8]: B0 07 15
273076 - MIDI IN [LPD8]: B0 07 14
273080 - MIDI IN [LPD8]: B0 07 13
273082 - MIDI IN [LPD8]: B0 07 12
273084 - MIDI IN [LPD8]: B0 07 11
273086 - MIDI IN [LPD8]: B0 07 10
273088 - MIDI IN [LPD8]: B0 07 0F
273089 - MIDI IN [LPD8]: B0 07 0E
273092 - MIDI IN [LPD8]: B0 07 0D
273094 - MIDI IN [LPD8]: B0 07 0C
273095 - MIDI IN [LPD8]: B0 07 0B
273098 - MIDI IN [LPD8]: B0 07 0A
273100 - MIDI IN [LPD8]: B0 07 09
273102 - MIDI IN [LPD8]: B0 07 08
273105 - MIDI IN [LPD8]: B0 07 07
273107 - MIDI IN [LPD8]: B0 07 06
273109 - MIDI IN [LPD8]: B0 07 05
273111 - MIDI IN [LPD8]: B0 07 04
273116 - MIDI IN [LPD8]: B0 07 03
273119 - MIDI IN [LPD8]: B0 07 02
273125 - MIDI IN [LPD8]: B0 07 01
273131 - MIDI IN [LPD8]: B0 07 00
and this for turning right:

Code: Select all

465887 - MIDI IN [LPD8]: B0 07 40
465925 - MIDI IN [LPD8]: B0 07 41
465953 - MIDI IN [LPD8]: B0 07 42
465990 - MIDI IN [LPD8]: B0 07 43
466018 - MIDI IN [LPD8]: B0 07 44
466048 - MIDI IN [LPD8]: B0 07 45
466113 - MIDI IN [LPD8]: B0 07 46
466149 - MIDI IN [LPD8]: B0 07 47
466192 - MIDI IN [LPD8]: B0 07 48
466215 - MIDI IN [LPD8]: B0 07 49
466244 - MIDI IN [LPD8]: B0 07 4A
466277 - MIDI IN [LPD8]: B0 07 4B
466292 - MIDI IN [LPD8]: B0 07 4C
466304 - MIDI IN [LPD8]: B0 07 4D
466315 - MIDI IN [LPD8]: B0 07 4E
466323 - MIDI IN [LPD8]: B0 07 4F
466331 - MIDI IN [LPD8]: B0 07 50
466337 - MIDI IN [LPD8]: B0 07 51
466346 - MIDI IN [LPD8]: B0 07 52
466349 - MIDI IN [LPD8]: B0 07 53
466354 - MIDI IN [LPD8]: B0 07 54
466357 - MIDI IN [LPD8]: B0 07 55
466360 - MIDI IN [LPD8]: B0 07 56
466364 - MIDI IN [LPD8]: B0 07 57
466366 - MIDI IN [LPD8]: B0 07 58
466368 - MIDI IN [LPD8]: B0 07 59
466371 - MIDI IN [LPD8]: B0 07 5A
466373 - MIDI IN [LPD8]: B0 07 5B
466375 - MIDI IN [LPD8]: B0 07 5C
466377 - MIDI IN [LPD8]: B0 07 5D
466379 - MIDI IN [LPD8]: B0 07 5E
466381 - MIDI IN [LPD8]: B0 07 5F
466383 - MIDI IN [LPD8]: B0 07 60
466386 - MIDI IN [LPD8]: B0 07 61
466388 - MIDI IN [LPD8]: B0 07 62
466389 - MIDI IN [LPD8]: B0 07 63
466391 - MIDI IN [LPD8]: B0 07 64
466393 - MIDI IN [LPD8]: B0 07 65
466395 - MIDI IN [LPD8]: B0 07 66
466397 - MIDI IN [LPD8]: B0 07 67
466399 - MIDI IN [LPD8]: B0 07 68
466401 - MIDI IN [LPD8]: B0 07 69
466402 - MIDI IN [LPD8]: B0 07 6A
466404 - MIDI IN [LPD8]: B0 07 6B
466406 - MIDI IN [LPD8]: B0 07 6C
466408 - MIDI IN [LPD8]: B0 07 6D
466409 - MIDI IN [LPD8]: B0 07 6E
466411 - MIDI IN [LPD8]: B0 07 6F
466413 - MIDI IN [LPD8]: B0 07 70
466417 - MIDI IN [LPD8]: B0 07 72
466419 - MIDI IN [LPD8]: B0 07 73
466422 - MIDI IN [LPD8]: B0 07 74
466426 - MIDI IN [LPD8]: B0 07 75
466429 - MIDI IN [LPD8]: B0 07 76
466430 - MIDI IN [LPD8]: B0 07 77
466434 - MIDI IN [LPD8]: B0 07 78
466437 - MIDI IN [LPD8]: B0 07 79
466440 - MIDI IN [LPD8]: B0 07 7A
466443 - MIDI IN [LPD8]: B0 07 7B
466446 - MIDI IN [LPD8]: B0 07 7C
466449 - MIDI IN [LPD8]: B0 07 7D
466456 - MIDI IN [LPD8]: B0 07 7E
466461 - MIDI IN [LPD8]: B0 07 7F
What I would like is my knobs have a range like this ... min---------max so when I put my knob on say middle position min----+----max mouse stays in that position when I put it a little to left my mouse goes slowly left but keeps going left but when I put it to min mouse goes faster left so every increment left my mouse goes faster left.. so vice versa for right, hope that clears things up

florian

2016-12-19 12:26:23

Hi wouter0102,
here's a relatively simple solution. It simply moves the mouse by 5 pixels for every value of the knob. It assumes middle position when loading the project in MT Pro.

The trick is that we need to calculate the difference from last position of the knob to new position. Then multiply that difference by 5 and move the mouse by that amount.
For remembering the last position of the knob K1, I use the global variable g1. Then I use local variables:
pp: new incoming controller value
qq: calculated amount to move the mouse left (negative) or right (positive).

Code: Select all

[x] Preset 0: Knob to Mouse movement
 Default MIDI IN ports:   LPD8

[x] Translator 0.0: Init
Incoming: on activation of this preset
Rules:
  // initialize knob 1 with middle position
  g1=64
Outgoing: (none)

[x] Translator 0.1: K1: left/right movement
Options: swallow
Incoming: Control Change on ch. 1 with CC#:1 (0x01) set 'pp' to value
Rules:
  qq=pp-g1
  qq=qq*5
  g1=pp
Outgoing: Mouse move qq horizontal 
Now this solution does not implement acceleration (if that's what you want), but on the upside, it will not drift, so going to center will always see the mouse pointer at the same position.

It should be easy to extend the preset with other features.

Attached is the project file.
Attachments
KnobToMouse.bmtp
(1.09 KiB) Downloaded 126 times

wouter0102

2016-12-19 13:44:28

So, right now I've got this set up is this going the right direction ?
Attachments
KnobToMouse.bmtp
(1.67 KiB) Downloaded 122 times

florian

2016-12-19 14:48:48

ah, I understand! you want the mouse to keep going!
Your preset is quite nice, especially the logic behind it. Attached is a slightly modified project.
One important thing: the Outgoing Action will by default be executed, so conditionally saying to execute the outgoing action will work, but it will also be executed if the condition is not satisfied.
Therefore, the best way is to reverse the condition and say "exit rules, skip Outgoing Action" to bail out instead.
E.g.:
Instead of
if pp>=70 then exit rules, execute Outgoing Action
say:
if pp<70 then exit rules, skip Outgoing Action

I've also shown a simple way for adding progressive speed. I use the (somewhat arbitrary) formula
timer_interval_ms=(val+20)*3
Where val is the controller value 0..57. For the movement to the right, you need to reverse the controller value by saying pp=127-pp.
Controller values 58..69 will stop the timers (sort of evenly spread around the center value 64), as you've already pretty much correctly set up.

Alternatively, it would be possible to have a timer with fixed interval, but the amount the mouse moves per interval is modified by the knob position.
Attachments
KnobToMouse2.bmtp
(2.16 KiB) Downloaded 154 times

wouter0102

2016-12-19 15:16:33

florian wrote:ah, I understand! you want the mouse to keep going!
Your preset is quite nice, especially the logic behind it. Attached is a slightly modified project.
One important thing: the Outgoing Action will by default be executed, so conditionally saying to execute the outgoing action will work, but it will also be executed if the condition is not satisfied.
Therefore, the best way is to reverse the condition and say "exit rules, skip Outgoing Action" to bail out instead.
E.g.:
Instead of
if pp>=70 then exit rules, execute Outgoing Action
say:
if pp<70 then exit rules, skip Outgoing Action

I've also shown a simple way for adding progressive speed. I use the (somewhat arbitrary) formula
timer_interval_ms=(val+20)*3
Where val is the controller value 0..57. For the movement to the right, you need to reverse the controller value by saying pp=127-pp.
Controller values 58..69 will stop the timers (sort of evenly spread around the center value 64), as you've already pretty much correctly set up.

Alternatively, it would be possible to have a timer with fixed interval, but the amount the mouse moves per interval is modified by the knob position.
Allright! Thank you that will help me a lot.