timer value

ohmbox

2014-03-31 21:32:23

Hey,

a simple question, i like to divide a timer value in a new translator?

So what i wannted to do is to grab the velocity value at a certain value and convert it to (xy) Keystrokes.
To check the total amount, i started at first with this two simple translator...


Translator:Midi Income:
incoming: B0 53 pp
Rules:if pp!=20 then exit rules, skip Outgoing Action
outcome=active timer / timer name = Timer / multiple times * pp


translator:Timer outcome
incoming: Timer:timer
outgoing:Keystrokes "Z"

so far so good everything works fine...
when my knob velocity reaches the value of 20 then 20 letter "Z" appears in my notepad (i used that to check)


but when i like to divide the timer value in the second translator (Timer outcome) it doesn´t work
i tryed many ways like:
example Rules: pp=pp/2

Check->the outcome are 20 Keystrokes instead of 10 :roll:

maybe i has to label variable of the timer income in a different way?


thanks

DvlsAdvct

2014-04-01 23:00:19

Hi ohmbox

I'm pretty sure I understand what you're asking for. To start, pp is what's called a Local Variable. Local Variables are only used for the initial translator and then forgotten by MT. So, using your translators as an example, MIDI Translator only calculates the value of pp in Translator 1 and it is not remembered for Translator 2.

If you want to divide the number of times that the keystroke Z is sent out you'd need to do it in the first translator. When do you want the timer to only trigger 10 times? Or, put a different way, why do you want to halve the rate of the timer? With that information we can start building rules to cover what you need.

ohmbox

2014-04-02 17:04:43

First off all Thanks.

Alright,with the local variables i understand and it when i am using the divide rule in the first Translator it´s going well. But i want to connect something and it´s possible with MT to connect Translators and outgoing Outputs or?

So my second Translator receives the output of the Timer.... i mean he gives me already 20 "Z" Keystrokes when i reach the Velocity 20 Value.
So there is a signal in the 2 Translator. how can i modulate that signal with rules?
Or how i call that variable when it comes from the outgoing timer in the First Translator and going through the second translator?

DvlsAdvct

2014-04-02 17:22:09

Hi again

The second translator is only responding to the amount of times the timers are being triggered. The modulation needs to occur in the first translator so it triggers different amounts of times. So, what you can do is use a variable for the amount of times the translator goes off, and calculate that in the rules of the first translator. It would look something like:

Code: Select all

Translator 1: Activate Timer
Incoming Message: B0 40 pp
Rules: if pp!=20 then exit rules, skip outgoing action
pp=pp/2
Outgoing Action: Rate Timer; 0ms Delay; Repeat Rate: pp
So this means that every time pp=20 the timer will repeat 10 times (20/2). The second translator, the one which responds TO the timer, will respond accordingly to the first translator. You can use Global Variables (g0, g1, g2...gz; h0, h1, h2...hz; i0...; j0...; etc. to nz) to control it from various sources. So, for example, if you want the amount of times the timer triggers to be based on the position of two knobs then you would use global variables to store the position of those knobs and a third translator to activate the timer based on their position. It would look something like:

Code: Select all

Translator 1: Knob 1
Incoming Message: b0 20 pp
Rules: g0=pp
Outgoing Message: B0 20 pp

Translator 2: Knob 2
Incoming message: B0 21 pp
Rules: g1=pp
Outgoing MEssage: B0 21 pp

Translator 3: Timer
Incoming Message: B0 22 pp
Rules: g2=g1-g0
If g2<0 exit rules, skip outgoing action
g2=g2*2
Outgoing Message: Activate Timer 0ms Delay; Repeat rate: g2

Translator 4: Timer Response
Incoming Message: Timer
Rules: pp=g2
Outgoing Message: B0 23 g2
So what happened is the position of the two knobs is subtracted and that value is multiplied by 2, which gives us the repeat rate. That is what causes the actual MIDI message from the timer to go off.

Does that help, or did I just completely overexplain everything?
Jared

ohmbox

2014-04-02 18:30:35

Thanks Jared.
Now i think i understand the logic behind that. :D

DvlsAdvct

2014-04-02 18:51:33

If you have any other questions don't hesitate to ask.