BU16 & 2 actions

Hello ! I have the BU16 and I want to send a sysex message by pressing a button (this is easy) and send another sysex message by pressing this button again… Is this possible? Thanks in advance !
Christian

Yes! Gimme a sec and I’ll show you an example. :slight_smile:

wow great thank you very much :pray:

First, you want to set the button mode to ‘Toggle’. This is done on the ‘Init’ tab of the button element:

Screenshot 2024-04-28 132619

Add an action block ‘BC Button Mode’ and put at the top (unsure if it matters where the block’s position is in this case but I put them at the top). Set the value to ‘1’. This is ‘Toggle’. Pushing the button toggles the self:button_value() between ‘0’ and ‘127’.

Next, on the button tab, you can change the ‘MIDI’ action block to ‘MIDI SysEX’. All of the values change to hex but I believe the parameters remain the same (channel, command, param1, param2). It’s detailed in the MIDI section of the docs at docs.intech.studio.

Screenshot 2024-04-28 130730

I currently have no need to use MIDI SysEX so you’ll have to modify things as you require. I’m just not caught up on the SysEX side of the standard.

What I have been doing, because I find it a bit easier, is converting the action block to code. You can check the box on the right of the action block and then select the ‘Merge to Code’ button at the top below the element tabs ‘[…]’

The reason I do this is because we are going to use an ‘IF’ statement to check some conditions. This is the code that will toggle between the two button states AND send a snippet of SysEX each time:

if self:button_value() == 0 and self:button_state() == 127 then
	midi_sysex_send(240, 65, 16, 127, 247)
elseif self:button_value() == 127 and self:button_state() == 127 then
	midi_sysex_send(240, 65, 16, 1, 247)
end

What the above is saying is: IF the button value is in one state of the toggle AND the button is currently pressed (instead of released) then send my sysex.

ELSE IF the button value is in the other state of the toggle AND the button is currently pressed (instead of released) then send my other sysex value.

The parts that you’ll need to modify are in the midi_sysex_send function. I just don’t know enough about SysEX to know what do input for the parameters.

You can create a MIDI SysEX action block then convert it to code and plunk it in the code snippet above. I just made up some generic values for my example.

There’s some other things that can be done to clean up the default variables etc., which I’m happy to answer questions on. But, this is just the code to get a button toggle sending two different messages on each button press. It also avoids sending two messages per button press. Each button press generates two events; one on press and one on release. You can configure the behavior to send the value on either the press or release (or both though I can’t imagine a use case for this).

Lastly, I’ve only had my Grid controllers for a couple of weeks and LUA (and coding in general) is pretty new to me. I’m learning a decent amount though and learning more as I pitch in to help :slight_smile:

I don’t work for Intech but I’m happy to help you work through any code stuff as I’ve covered some pretty common use cases so far for my own devices.

Thanks a lot for your help ! I didn’t expect to have to type codes with these devices… I’ll test this, for the moment it doesn’t work (maybe my sysex codes are too long or Intech doesn’t recognize them…
It’s initially to create shortcuts for my Behringer X32 rack…
In any case, thank you very much for these tips, I will look for them on my own!

1 Like

Generally, you wouldn’t have to. They have some smart code to self assign MIDI channel and CCs based on how they’re connected. The Editor let’s you take it a step further for sure. However, I imagine it would be challenging to create ‘Action Blocks’ to accommodate the myriad different scenarios a user might want to configure.

I think there’s some room for improvement on the ‘Action Blocks’ for sure. The biggest for me would be to have radio buttons to select if the action happens on a button press or release instead of on both. I suspect the Editor will only get better with time. The devs could probably just use some feedback to help with the process. :slight_smile:

Let me know if there’s anything else I can help with.

Do you have an example of the full sysex message that you’re trying to send? I’m certain there’s a way forward.

Yes you are right, the possibilities are evolving ^^

Yes, here is an example of a code that I want sent with the first press:
0x2F 0x63 0x68 0x2F 0x31 0x33 0x2F 0x6D 0x69 0x78 0x2F 0x30 0x33 0x2F 0x6F 0x6E 0x20 0x4F 0x46 0x46 0x20 0x54 0x65 0x78 0x74 0xF7
Then another code with the second press:
0x2F 0x63 0x68 0x2F 0x31 0x33 0x2F 0x6D 0x69 0x78 0x2F 0x30 0x33 0x2F 0x6F 0x6E 0x20 0x4F 0x4E 0x20 0x54 0x65 0x78 0x74 0xF7

Originally, sysex codes are transcribed in classic hexadecimal like this:
F0 00 20 32 32 2F 63 68 2F 31 33 2F 6D 69 78 2F 30 33 2F 6F 6E 20 4F 46 46 20 54 65 78 74 F7.
But I have the impression that grid expects the other form…

wow, I forgot the commas! Grid therefore recognizes this type of sysex code a priori:
0xF0, 0x00, 0x20, 0x32, 0x32, 0x2F, 0x63, 0x68, 0x2F, 0x31, 0x33, 0x2F, 0x6D, 0x69, 0x78, 0x2F, 0x30, 0x33, 0x2F, 0x6F, 6E, 0x20, 0x4F, 0x46, 0x46, 0x20, 0x54, 0x65, 0x78, 0x74, 0xF7

I think it will just be a matter of sending multiple midi_sysex_send() messages. You can stack them up like this:

if self:button_value() == 0 and self:button_state() == 127 then
	midi_sysex_send(240, 65, 16, 127, 247)
    midi_sysex_send(240, 65, 16, 1, 247)
elseif self:button_value() == 127 and self:button_state() == 127 then
	midi_sysex_send(240, 65, 16, 1, 247)
    midi_sysex_send(240, 65, 16, 1, 247)
end

But, each of those parameters are a certain thing. So, only a certain parameter can send values.

You are constrained to 399 characters per element though.

For example, this:

midi_sysex_send(240, 65, 16, 127, 247)

Sends this:

f041107ff7

Yes, with two codes + your idea, I have… 470 characters :sweat_smile:
I’ve already made progress, that’s good news. I think my codes will be too long, at worst I will use 2 buttons… But I will continue to test different things, that is motivating!

Just checking now but it looks like you can make a ‘MIDI Sysex’ action block then covert it to code to get the values in decimal. No need for multiple midi_sysex_send() functions.

Standby…

There’s probably some default variables you can turf. Let me see what I can come up with for a full button code’s worth.

The code below should work. This is one code block. So, delete all blocks on the button and do one code block:

local num = self:element_index()
if self:button_value() == 0 and self:button_state() == 127 then
	midi_sysex_send(47, 99, 104, 47, 49, 51, 47, 109, 105, 120, 47, 48, 51, 47, 111, 110, 32, 79, 70, 70, 32, 84, 101, 120, 116, 247)
elseif self:button_value() == 127 and self:button_state() == 127 then
	midi_sysex_send(47, 99, 104, 47, 49, 51, 47, 109, 105, 120, 47, 48, 51, 47, 111, 110, 32, 79, 78, 32, 84, 101, 120, 116, 247)
end;
led_value(num, 1, val)

330/399 characters :slight_smile:

This is what’s being sent (message is truncated because of the monitoring box):

Screenshot 2024-04-28 145915

1 Like

ooh! THANKS ! I’m testing this!!

1 Like

Well, after spending hours testing several scenarios, I’m throwing in the towel… It seems that the sysex is not correctly transmitted by the Intech modules (tested with BU16 & PBF4) (I’m leaving the BU16 in MIDI DIN via the KNOT).
I probably missed something but it’s too tedious for me… I’m disappointed because if you have to spend hours programming each button without it ultimately working… my old BCR2000 did better !
I’m going to let it rest and if I don’t have the courage to start again, I’m going to sell my Intech equipment. Too bad, I loved the small format for my live shows and it seemed scalable.
Thank you very much for “taking the lead” for me :pray: :pray:.

1 Like

I’ve figured out the issue. Bear with me while I type…

You were needing the output to be:

F0 00 20 32 32 2F 63 68 2F 31 33 2F 6D 69 78 2F 30 33 2F 6F 6E 20 4F 46 46 20 54 65 78 74 F7

And my screen shot was showing two outputs of 2f63… for both button presses.

Your first line of hex has an error:

0xF0, 0x00, 0x20, 0x32, 0x32, 0x2F, 0x63, 0x68, 0x2F, 0x31, 0x33, 0x2F, 0x6D, 0x69, 0x78, 0x2F, 0x30, 0x33, 0x2F, 0x6F, 6E, 0x20, 0x4F, 0x46, 0x46, 0x20, 0x54, 0x65, 0x78, 0x74, 0xF7

You were missing a 0x on one of the bytes. It broke the value. I updated it, and ran the button press and it sends out exactly what you need:

Hex

Double check your second sysex command to see if it is correct. The typo is almost certainly the hangup.

I’m off to dinner now (and you’re likely in bed as I assume you’re the Christian from PH Modular in France :wink: ).

I’m confident we can get this sorted out. And, once it’s clear how to add sysex to the ‘MIDI Sysex’ action block correctly (which is just pasting in the hex in the 0x format separated by commas) then, this will be just as easy to setup.

Let me know if that get’s it sorted out.

Erm…updated code assuming the second button press sysex is correct:

local num = self:element_index()
if self:button_value() == 0 and self:button_state() == 127 then
	midi_sysex_send(240, 0, 32, 50, 50, 47, 99, 104, 47, 49, 51, 47, 109, 105, 120, 47, 48, 51, 47, 111, 110, 32, 79, 70, 70, 32, 84, 101, 120, 116, 247)
elseif self:button_value() == 127 and self:button_state() == 127 then
	midi_sysex_send(47, 99, 104, 47, 49, 51, 47, 109, 105, 120, 47, 48, 51, 47, 111, 110, 32, 79, 78, 32, 84, 101, 120, 116, 247)
end

I also removed the led_value() function so that can be added back after the button press is confirmed to be sending the correct sysex.

1 Like

I did it again thanks to you (yes, I’m Christian from “ph modular France” ^^), and it almost works.
In fact, yesterday, even a simple sysex message did not work (without trying to press a button twice, using a simple method.
I checked my MIDI channel and the problem was with the INTECH KNOT. I tested with another “USB midi host” and it worked perfectly. I did a manipulation with the KNOT (update but it didn’t work) despite everything, now the KNOT transmits simple SYSEX messages correctly!
It’s a good start. I actually cannot transmit a longer message because there is not enough character memory. In the meantime, I’m using one button per function, that’s not bad…

Your new code doesn’t work (it transmits a sysex every other time), but don’t worry, I’m getting there, I’m testing other ways to achieve this with a single code because I know that by integrating the term “val” in the right place in my SYSEX code, maybe it worked, I’ll look for that…
Thank you so much for spending all this time for me! :pray: :pray:

1 Like

The reason mine only works on one press is likely because the second sysex string is incorrect. If you have the value you’re trying to send for the second, in both the F000… format the Behringer expects and the 0x format the Grid needs, then code could be updated.

With regards to the Knot, do you have the A/B switch in the appropriate position? Also, and this would only matter if your have something going to MIDI in, are you in Merge or Don’t Merge mode? Blue is Merge and Green is Don’t merge. Toggled with the Mode button.

Also, and this messed me up, the Knot’s USB C port only seems to be for power delivery and firmware updates.

1 Like

Two things just occured to me:

  • Quite a few posts back you said “Ox…” is one message I’m trying to send and “0x…” is a second one. I took that to mean that on the first button press you want the first message and on the second press you want the second message. Is this what you want or is it you want one button to toggle the Behringer parameter on and off using the first message and you want a second button to toggle another parameter on the Behringer with the second message?

  • You mentioned that you got this to work but using ‘val’ in the correct position. ‘val’ is the value of the button. Because the button is set to ‘Toggle’, each button press toggles the value from ‘0’ to ‘127’ and vice versa. This is how I expect toggles to work when I’m sending CC to toggle; CC with value 0 on one press. CC with value 127 on the next press.

If my code only works once it’s because it’s only working when it sends ‘0’. I don’t have ‘val’ in my hex that I used from you (the first message you posted with the one byte corrected). It would make sense that it only works once because we NEED to use the ‘val’ variable OR we need to find which byte corresponds to ‘val’ and put 127 in hex form there.

Apologies for all of the back and forth. This would be much, much easier with a desktop screen share OR if I had the Behringer (or some other device here that I could test Sysex in this fashion) here with me to noodle with.

The good thing is, I’m learning at the same time about how it fits together. Sadly, that’s at the expense of your patience :stuck_out_tongue:

1 Like