I want to make a rule that sends a midi note message between two values on a fader. For example if the fader is between value 4B and 5B it will send one MIDI message.
Also, once the fader reaches this range, I would like it to just send the note message once until it goes out of range.
I want to activate both translators only once when it is in the range between a set of values (4B-5B). After it fires once, nothing happens until the fader reenters the set of values again.
The way I have it now is I have two translators: note on/off that will activate at the same time when a specific value is reached (ie. 00 or 7F). The note off translator has a 50ms delay. This works fine for me for a specific value but I don’t know how to write the rule to specify a set of values.
If we are within range we send a note-on or note off based on the value of ga
We use gb to determine whether we went out of range or not. We set gb to 0 any time we go
out of range and back to 1 when we have sent the note on or off.
In this case I’m use Note-on on MIDI CH 1 0x90 or Note -Off on MIDI CH 1 0x80
For note-on, I use a value of 127 and for note-off I use a value of 0
In this case I’m sending note 0x40 (decimal 64)
Here are the commented rules:
if qq<75 then Goto “Out Range”
if qq>91 then Goto “Out Range”
// gb=1 means note-on or note-off sent
// ga=1 means note on ga=0 = note off
Label “In Range”
// toggle note on/off
ga=ga^1
// check if note sent
// Has the note been sent yet?
if gb==1 then exit rules, skip Outgoing Action
// set note sent until we go out of range
gb=1
// Evaluate whether not on or note off
Goto “Note-Type”
Label “Out Range”
// Out of range, note no longer sent
gb=0
exit rules, skip Outgoing Action
Label “Note-Type”
// Note on
if ga==1 then pp=144
// Note off
if ga==0 then pp=128
// Note on velocity
if ga==1 then rr=127
// Note off velocity
if ga==0 then rr=0
Hi Steve,
I just tried it and I need the note off message to fire right after the note on message is sent (50ms worked for me in my tests).
Your translator only fires one on/off message when you go within range. I need a note on and then a note off message in order for the command to work with my equipment.
Sorry if I wasn’t clear before. I looked at your rules and saw the how you use the Label command which I think would really help me cut down on the number of translators I have.
I think we are almost there, though. I just need to see how you would add a delay time in the rules. Or would it be best to use a timer?
OK, this takes at least 2 translators since there has to be 2 outgoing actions when within range.
The first one fires note-on and if within range. If out of range (gb=1 meaning already fired) it does nothing
The second one fires note-off with 50ms delay and sets gb=1 when within range
Both do nothing when out of range. If you don’t need the delay for the note-off you could use raw MIDI in just one translator to handle both (as long as you set gb=1 after you fire it and gb=0 when it goes out of range).