Key Stroke to MIDI CC toggle, how to achieve

Hello. New user here. I have successfully set up a P.I. Engineering X-Keys (XK-24) to send F13-F24 key strokes, and I have Bome MT Pro translating those into MIDI CC. This allows me to use the X-Keys as a MIDI control surface in my DAW and I have mapped the buttons to various controls such as transport. However, I would like the action of some of the buttons to be a toggle action. I have been reading the manual and numerous posts here in the forum, but I have to admit that it’s all very confusing. I am coming from using a Native Instruments Maschine MK2 controller which has a controller editor that allows the user to simply select if they would like to use a button as a toggle (or trigger, gate, etc.) I was hoping it would be this easy in Bome MT Pro, but alas it seems I must learn some very technical code and logic in order to program this. As I said, I have been reading a lot on this forum and in the manual, but it all seems highly technical and I’m just not grasping it. Additionally, I did not find any forum posts about toggles that exactly match my scenario (key stroke->midi cc toggle) so I am wary of trying to copy solutions from those posts. Any help is of course greatly appreciated. Thank you.

Hi and welcome to the community.

Setting up as a toggle requires just a few rules.

Here is an example of using an incoming CC message of 127 to goggle between 127 and 0 on the output

Incoming CC6 on MIDI CH1 value 127

Rules:
// toggle the global variable “ga”
ga=ga^1
// set default outgoing value
qq=0
if ga==1 then qq=127

Ongoing: CC 6 on MIDI CH 1 value qq

Steve Caldwell
Bome Customer Care


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

Thanks, Steve. However, I see your example shows incoming MIDI. My current usage is different in that I don’t have incoming MIDI, I have an incoming key stroke. Would this rule work the same regardless? Or do I need to set up two translators, one to convert the key stroke to MIDI and another to apply the rule as you show with the MIDI output of the first translator becoming the MIDI input you show in your example? And if so, does that mean I have to somehow loop the first translator back into Bome MT Pro via a different MIDI port than the final MIDI output port (to avoid feedback)? (I’m admittedly confusing myself with this line of questioning, but I hope you get my meaning.)

Hi,

First of all, please realize that the incoming keystroke is not suppressed by Bome MIDI Translator. If you want each button as a toggle you can use my logic and use a different global variable for each incoming keystroke. I used ga for the first so gb would be useful for the second. For undertanding the naming convention of global and local variables, you can refer to the Bome MIDI Translator Pro (MT Pro) manual (press F1 while in MT Pro).

Steve Caldwell
Bome Customer Care


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

Thanks again, Steve. Unfortunately I have no idea what you mean by “the incoming keystroke is not suppressed by Bome MIDI Translator” so I’m not sure how to apply that to my question. However, I gather by the rest of your response that the rules example you provided will work the same regardless of whether the input is a key stroke or MIDI. Is that correct? I suppose I can go ahead and give it a shot to see if it works. I did read the manual regarding the global and local variables, but as I said in my original post it’s all kind of going over my head. Like I said, the last MIDI controller “programming” I did involved a user interface that simply has a drop down to select toggle, gate, trigger, etc. and what I’m seeing with Bome is far more technical. I may understand it eventually, but for now it is an alien language to me. Thanks again for your help, though!

Yes, my point about keystrokes is that if your OS sees keystrokes from your controller, it will still see them.

The “^” is an exclusive or function so

ga=ga^1

is the same as:
pp=0
if ga==1 then pp=1
if ga==0 then pp=0
ga=pp

Any time you exclusive or a value of 1 with another value it will essentially toggle the value of the other value.

Yes, I understand that most other programs allow for higher level functions, however doing things this way can provide a great deal of flexibility. As I understand at some point in time there will be a MT Pro version 2 which will have higher level programming constructs and maybe even some functions. No telling when this will happen however.

Steve Caldwell
Bome Customer Care


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

Hi, Steve. Happy to report I got the toggle rule working, but there’s a strange hiccup in the way it’s functioning. All is working well if I cycle only one button with this toggle action, but with multiple keys set up to toggle I find that it takes multiple key presses to get the toggle action to occur, and depending on the pattern of key presses sometimes nothing occurs at all. For example, I have two separate targets in my DAW, each one I want to toggle on or off separately. If I press they first key I have mapped (that also includes the toggle rule) it indeed switches the first target on. An additional press of this first key then switches the target off. This is great. But if I press the first key and the target in my DAW switches on, then I press the next key to switch the next target on, nothing happens. It takes two key presses of the second key to switch the target on. Any idea why? Do I need an additional rule to account for multiple keys set up with the toggle rule?

Hi, my guess is you are using ga for both keys as the global variable. Use gb for the second. If not, please post your project file and I will have a look.

1 Like

Oh, that makes sense now. I did use the same global variable for them both. I will try using different ones for each. Thanks so much for your quick replies!

Working wonderfully! Thanks, Steve!

Great!

Steve Caldwell
Bome Customer Care


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