Building midi message via rules

I’d like to compose a series of midi messages via the rules and then send those via the output.

The use case is that I’d like to change all 16 RGBs to a given color on the MF twister.
And in the rules I can create a loop to do this with fewer lines of code.

However I don’t fully understand how to compose the midi message.

I see in another example someone added 192 to a input variable containing the channel to represent the channel + program change. Thus I’m guessing this is possible through variable concatenation even though strings aren’t supported. But I don’t understand the operation. Can I get some guidance? Perhaps a simple example showing how to string together multiple midi messages in a variable in the rules section.

Also, is this a reasonable approach and best practice? I’m trying to avoid having 16 separate translators that I may have to then go back and change every single one when I need to make a change.

Hi, you will need 16 global variables, one for each LED value (color). Then, if I remember you send note-on messages on a MIDI channel 2 with the same note or CC number assigned to the MIDI Fighter twister push function.

So an example of this where g0-gf are the global variables used and all with the same color of 127 (7f hex) would be. I’m assuming the pushes are assigned 0-F as well
// set status byte to note on MIDI CH2
pp=0x91
// set all other bites to 127 update rules to the values you want if different
qq=127
g0=qq
g1=qq
g2=qq
g3=qq
g4=qq
g5=qq
g6=qq
g7=qq
g8=qq
g9=qq
ga=qq
gb=qq
gc=qq
gd=qq
ge=qq
gf=qq

Outgoing: Raw MIDI pp 00 g0 pp 01 g1 pp 02 g2 … continue with g3=gf … pp 0f gf

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

Amazing! Thank you Steve. Exactly what I needed.

For me, pp=0xB1 works since I’m using them as CC.

Great! Enjoy, MIke!