Two Inputs with One Output?

nuggets105

2020-09-01 09:33:11

Is it possible to combine two midi button inputs to create a single output keystroke?

I am trying to convert my midi controller which has 16 buttons on it into a keyboard to type with, purely for fun. Since there are 26 letters in the alphabet and I plan on splitting the letters into 3 different "layers" that I will need to toggle between, I created two different "switch layer" buttons, that when held down individually, changes the function of all of the keys. This makes it possible to access all 26 lowercase letters.

I have created an "uppercase" button as well that I can hold down to access the uppercase version of each letter on the default layer 1.

But I am stumped trying to figure out how to type an uppercase button that's located on the 2nd or 3rd layer, since that would require holding down both my "switch layer" and "uppercase" button at the same time. I have a clunky workaround in mind, but I'd like to know if there is a simple solution here since I'd prefer to use the same "uppercase" button no matter which layer I am typing on, instead of creating a different uppercase button for layer 2 or layer 3. I have no programming experience but am willing to look into whatever it takes to make this work.

Thanks,

A

Steve-Bome Forum Moderator

2020-09-01 17:34:46

Hi,

Please find the attached.

I handle case by switching presets.

I handle character number by manipulation of the value of  the global variable \"ga\" where ga is the layer number 0,1,2 or 3 (we are not using 3).

For character number we check the value of ga in rules and only output if we are on the current layer.

The global variable ga is a bit map. Turning on bit 0 or bit 1 is pretty straight forward with note on. I use note 64 for bit 0 and note 65 for bit 1.

For layer 0, we turn only the appropriate bit off which is a little trickier since we only want to effect the appropriate bit of ga

Here is the code if you are using note 64  for layer 1 and note 65 for layer 2

if pp<64 then exit rules, skip Outgoing Action
if pp>65 then exit rules, skip Outgoing Action
// Determine bit number
pp=pp-63

// This will clear only bit 0 or bit 1 in ga
// Note 64 off clears bit 0
// Note 65 off clears bit 1

// Exclusive or it with -1 to reverse all bits
pp=pp^-1
// Now AND with the last value of ga to clear the appropriate bit
ga=ga&pp

Layer 0  translators have these rules:

if ga>0 then exit rules, skip Outgoing Action

 

Layer 1 translators have these rules

 

if ga!=1 then exit rules, skip Outgoing Action
if ga!=1 then exit rules, skip Outgoing Action

 

Layer 2 translators have these rules:

if ga!=2 then exit rules, skip Outgoing Action
if ga!=2 then exit rules, skip Outgoing Action

I set up a timer \"init\" that fires at startup to:

  1. Set global variables (ga=0)
  2. Select lower case preset turning other preset off.

 

I wasn\'t sure what characters you wanted on layer 2 so I just picked a few. Also wasn\'t sure what notes you wanted to use to fire each character.

I hope this helps get you started.

 

Steve Caldwell


Attachments:

char-layer-example-2020-09-01.bmtp