two keys for incr up/down

beatskk

2009-11-11 18:41:33

title says it all. is it possible?

ruediger

2009-11-16 20:52:20

Hi,

don't know what you want to do. Please explain it step by step...

RĂ¼di

florian

2009-11-17 09:40:07

do you want to define two keys (on computer keyboard? or on MIDI keyboard?) that, when pressed, increase (or decrease, respectively) controller value, i.e. a fader or slider in a program?

Thanks,
Florian

beatskk

2009-11-18 05:23:34

hi,

yes, florian, that's exactly what i wanted. i should know better than to ask for help without properly describing my problem. won't happen again.

anyway, i think i have it down:
--------------- Preset fx select incr


Translator 0 :+
Options: swallow,2 rules
Incoming: MIDI 90 3D 7f
Rules:
ga=ga+1
if ga>15 then ga=15
Outgoing: (none)

Translator 1 :New Translator
Options: swallow,2 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=15 then exit rules, skip Outgoing Action
ga=-1
Outgoing: MIDI B0 17 00

Translator 2 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=0 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 05

Translator 3 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=1 then exit rules, skip Outgoing Action
Outgoing: MIDI b0 17 0d

Translator 4 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=2 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 16

Translator 5 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=3 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 1e

Translator 6 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=4 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 27

Translator 7 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=5 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 2f

Translator 8 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=6 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 38

Translator 9 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=7 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 40

Translator 10 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=8 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 48

Translator 11 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=9 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 51

Translator 12 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=10 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 5b

Translator 13 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=11 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 64

Translator 14 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=12 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 6c

Translator 15 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=13 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 75

Translator 16 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3D 7F
Rules:
if ga!=14 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 7f

Translator 17 :-
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
ga=ga-1
Outgoing: (none)

Translator 18 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=1 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 00

Translator 19 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=2 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 06

Translator 20 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=3 then exit rules, skip Outgoing Action
Outgoing: MIDI b0 17 0d

Translator 21 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=4 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 16

Translator 22 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=5 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 1e

Translator 23 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=6 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 27

Translator 24 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=7 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 2f

Translator 25 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=8 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 38

Translator 26 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=9 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 40

Translator 27 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=10 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 48

Translator 28 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=11 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 51

Translator 29 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=12 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 5b

Translator 30 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=13 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 64

Translator 31 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=14 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 6c

Translator 32 :New Translator
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=15 then exit rules, skip Outgoing Action
Outgoing: MIDI B0 17 75

Translator 33 :New Translator
Options: swallow,2 rules
Incoming: MIDI 90 3C 7F
Rules:
if ga!=0 then exit rules, skip Outgoing Action
ga=16
Outgoing: MIDI B0 17 7f

Translator 34 :reset timer
Options: swallow,1 rules
Incoming: MIDI 90 3C 7F
Rules:
gb=1
Outgoing: One-shot timer "reset selector": 350 ms delay

Translator 35 :reset timer stop
Options: 1 rules
Incoming: MIDI 80 3C 7F
Rules:
gb=0
Outgoing: (none)

Translator 36 :reset
Options: 2 rules
Incoming: On timer "reset selector"
Rules:
if gb!=1 then exit rules, skip Outgoing Action
ga=0
Outgoing: MIDI B0 17 00

the thing i've spend most time on was making it go from 0 to 127 and reverse.

the values are a bit strange, but they match the sixteen steps on an apc40 encoder (including zero), so i have a visual indicator from the knobs' led circle.

the last three translators are for resetting to zero if the decrease button is held for more than 350ms.

it's a lot of translators, is there a quicker way to do this? what if i wanted 128 steps?

regards

florian

2009-11-23 09:54:03

Hi,

yes, that's a good way to do it.

In order to optimize it, you can formulate the outgoing controller value as a mathematical expression:

Your translators #1 to #16 can be combined into one single translator. Use a rule to compute an outgoing value in the variable pp:

Code: Select all

Translator: Send increased controller
Incoming: MIDI 90 3D 7F
Options: swallow
Rules:
  pp=ga*8
  if pp>=128 then pp=127
Outgoing: MIDI B0 17 pp
The factor 8 determines the step size. E.g. if you use 6 instead of 8, it will increase slower.

As I understand it, you want the values to wrap around, i.e. if the maximum is reached, start over from the beginning. Then you can write translator #0 as such:

Code: Select all

Translator 0 :+
Options: swallow
Incoming: MIDI 90 3D 7F
Rules:
ga=ga+1
if ga>15 then ga=0
Outgoing: (none) 
Of course you can also optimize the translators for decreasing the value. And I'd put the increase/decrease translators at the bottom so that they are executed AFTER sending the controller value.
Final preset:

Code: Select all

Translator 0: Send increased controller
Incoming: MIDI 90 3D 7F
Options: swallow, NOT stop
Rules:
  pp=ga*8
  if pp>=128 then pp=127
Outgoing: MIDI B0 17 pp

Translator 1: Send decreased controller
Incoming: MIDI 90 3C 7F
Options: swallow, NOT stop
Rules:
  pp=ga*8
  if pp>=128 then pp=127
Outgoing: MIDI B0 17 pp

Translator 2 :+
Options: swallow
Incoming: MIDI 90 3D 7F
Rules:
ga=ga+1
if ga>15 then ga=0
Outgoing: (none) 

Translator 3 :-
Options: swallow
Incoming: MIDI 90 3C 7F
Rules:
ga=ga-1
if ga<0 then ga=15
Outgoing: (none)
Of course, leave the three timer translators as they are.

You could even combine Translators 0 and 1 into one, as they are identical except the incoming trigger. You could use "MIDI 90 qq 7F" as incoming, and check in the rules that qq is 3C or 3D. But probably that wouldn't optimize performance.

Hope that helps!
Florian

beatskk

2009-12-03 23:35:41

wow.
thanks man, that looks great. great support.