Send a MIDI message to all the CCs after pressing a keyboard key

Victor

2016-08-21 17:52:04

Hi

Now I've created a translator that everytime I press the W key, its sends a 7F message to the CCs from 0 to 9 when is pressed once, and 00 when is pressed twice.

1) "Incoming" tab:
Select the Incoming Trigger type -> Keystroke
Key Press (Down & Up) -> W

2) "Rules" tab:
Add Rule -> Expression -> ga=ga+127
Add Rule -> Conditional -> if ga>127 then ga=0

3) "Outgoing" tab:
Select the Outgoing Action type -> MIDI message -> bf 00 ga bf 01 ga bf 02 ga bf 03 ga bf 04 ga bf 05 ga bf 06 ga bf 07 ga bf 08 ga bf 09 ga

On this one, I had to mention each CC from 00 to 09 on the Outgoing, but I'll to know if there's a way of do it with variables or something for make it short.

Cheers

florian

2016-09-03 16:20:28

Hi Victor,
I don't really see a better way to do this. Alternatively, you could create 10 translators, each with the same incoming action and a different outgoing control change message. The rules would then only be necessary in the first translator. However, This way is probably not shorter...

Regards,
Florian

TomViolenz

2016-09-30 13:00:23

Ha interesting I had no idea sending to serveral different MIDI messages from one translator was even possible :D

Anyways what I usually do in these cases (and which would be an alternative), I let translator 1 triggered from your input start a timer as outgoing action with as many repeats as midi messages must be send, so ten in your case (with only 1 ms repeat time).
This translator will also contain your: ga rules
ga=ga+127
if ga>127 then ga=0

I also set gb here:
gb=-1

And then use this timer as the incoming action for the second translator. In this then I add a counter that counts gb up every time the timer triggers it:
gb=gb+1
If gb > 9 then gb = 0

And then in the outgoing action I use

BF ga gb

florian

2016-10-01 15:51:51

clever! that'll work nicely, too! Have you tried setting repeat delay to 0ms? I actually don't know if that'll work :)
Florian

Victor

2016-10-02 06:19:21

Hi Tom,

Well, now is me who have learned something new, because I had no idea about the use of Timers.
However, I had to put ga on second place in the output or it will change only the value of CC0 (Bank MSB) and CC127 (Poly On):

BF ga gb
CH DATA1 DATA2 NOTE EVENT
ON
BF 7F 00 CC: Poly On
BF 7F 01 CC: Poly On
BF 7F 02 CC: Poly On
BF 7F 03 CC: Poly On
BF 7F 04 CC: Poly On
BF 7F 05 CC: Poly On
BF 7F 06 CC: Poly On
BF 7F 07 CC: Poly On
BF 7F 08 CC: Poly On
BF 7F 09 CC: Poly On
OFF
BF 00 00 CC: Bank MSB
BF 00 01 CC: Bank MSB
BF 00 02 CC: Bank MSB
BF 00 03 CC: Bank MSB
BF 00 04 CC: Bank MSB
BF 00 05 CC: Bank MSB
BF 00 06 CC: Bank MSB
BF 00 07 CC: Bank MSB
BF 00 08 CC: Bank MSB
BF 00 09 CC: Bank MSB


when I was looking for change the CCs:
BF gb ga
CH DATA1 DATA2 NOTE EVENT
ON
BF 00 7F CC: Bank MSB
BF 01 7F CC: Modulation
BF 02 7F CC: Breath
BF 03 7F CC: Control Change
BF 04 7F CC: Foot Controller
BF 05 7F CC: Portamento Time
BF 06 7F CC: Data Entry MSB
BF 07 7F CC: Volume
BF 08 7F CC: Balance
BF 09 7F CC: Control Change
OFF
BF 00 00 CC: Bank MSB
BF 01 00 CC: Modulation
BF 02 00 CC: Breath
BF 03 00 CC: Control Change
BF 04 00 CC: Foot Controller
BF 05 00 CC: Portamento Time
BF 06 00 CC: Data Entry MSB
BF 07 00 CC: Volume
BF 08 00 CC: Balance
BF 09 00 CC: Control Change


And yes, Florian, it does works with repeat delay to 0ms :)
Thanks to both of you for your help !

florian

2016-10-04 09:37:00

excellent! Thanks for reporting back.
Florian

Victor

2016-10-04 11:57:51

Tom, replace the ga rules of the first translator:

Code: Select all

ga=ga+127
if ga>127 then ga=0
with this:

Code: Select all

ga=127-ga
:D

TomViolenz

2016-10-04 16:24:31

florian wrote:clever! that'll work nicely, too! Have you tried setting repeat delay to 0ms? I actually don't know if that'll work :)
Florian
Yes, I tried that. It doesn't work. But 1ms repeat time updates a whole Launchpad worth of lights in 64ms or about a 1/32 note (at 120BPM). That's hardly perceivable.

TomViolenz

2016-10-04 16:40:01

Victor wrote:Hi Tom,

Well, now is me who have learned something new, because I had no idea about the use of Timers.
However, I had to put ga on second place in the output or it will change only the value of CC0 (Bank MSB) and CC127 (Poly On):
That confuses me.

According to your OP ga was the variable to be switched between 0 and 127 , which I took to be the value (or velocity for notes) while I set up gb as the Midi number/identifier that needs to count up so you catch the whole range.

So I would keep it at:

BF (channel) gb (number) ga (value)

(with BF being the hexadecimal for the MIDI-channel 16)
Victor wrote: And yes, Florian, it does works with repeat delay to 0ms :)
Thanks to both of you for your help !
Interesting, maybe something changed in an update?! When I tried it a while back 1ms was the lowest it would go.
I'll try it again

Victor

2016-10-05 09:29:52

Yeah, that's exactly what I mean!
Victor wrote: when I was looking for change the CCs:
BF gb ga

CH DATA1 DATA2 NOTE EVENT
ON
BF 00 7F CC: Bank MSB
BF 01 7F CC: Modulation
BF 02 7F CC: Breath
BF 03 7F CC: Control Change
BF 04 7F CC: Foot Controller
BF 05 7F CC: Portamento Time
BF 06 7F CC: Data Entry MSB
BF 07 7F CC: Volume
BF 08 7F CC: Balance
BF 09 7F CC: Control Change
OFF
BF 00 00 CC: Bank MSB
BF 01 00 CC: Modulation
BF 02 00 CC: Breath
BF 03 00 CC: Control Change
BF 04 00 CC: Foot Controller
BF 05 00 CC: Portamento Time
BF 06 00 CC: Data Entry MSB
BF 07 00 CC: Volume
BF 08 00 CC: Balance
BF 09 00 CC: Control Change


When I mention to put the ga at the second place, I wasn't counting the midi-channel (BF), so yeah, it'll be at the end, but you also make a mistake at the end of your first post:
TomViolenz wrote: And then in the outgoing action I use

BF ga gb
That confused me till that I found out it was wrong, but it's ok. The bottom line is that we learn different ways to do the same task and we share it. The use of a timer is very cool, and now I'll rather use it instead of put ALL midi messages on the translator.

And here is a screenshot of the timer on the translator:
sshot-1.png
sshot-1.png (47.01 KiB) Viewed 2873 times
Thank you guys for your help!

TomViolenz

2016-10-05 12:02:55

Good that you got it sorted :-)

Just one more tip: I usually don't use global variables in the Midi incoming/outgoing fields but local ones.
(and I always use the same local ones, this saves on a lot of confusion)

It's just one extra step, (translating the variables) but it allows you to do much more. Because the translation doesn't have to be one to one

For instance you wouldn't even need a continuous Midi range with this translation step.

Like this:

rr = gb
ga=ga+1
if ga>10 then ga =0

if ga = 1 then ss = 5
if ga = 2 then ss = 7
if ga = 3 then ss = 12
......



Outgoing action:

BF ss rr


I do this quite often 8)

florian

2016-10-05 12:03:43

Victor, you're using an old version of MT Pro! I'll check that the current version supports 0ms repeat delay for non-infinite timers.

florian

2016-10-05 21:14:11

ha, it doesn't! That'll be fixed with the next version.
Florian