Output Note Z only if notes X and Y are pressed

florian

2016-02-02 11:28:50

A user asks if this is possible: basically: X+Y=Z.

florian

2016-02-02 11:45:30

That's definitely possible!
There is no direct "AND" function for the incoming action. But it is not so hard to emulate it by using global variables (e.g. "g0" and "g1") to remember if "X" and "Y" are pressed.

When should Z be released? When both X+Y are released or either one? I suspect the latter, so it's possible to retrigger Z by merely replaying X while holding down Y (or vice versa).

Here is the schematics:

Code: Select all

[x] Translator 0.0: Down X
Options: swallow
Incoming: Note On X
  Note On on channel 1 with note:60 (0x3C) set 'pp' to velocity
Rules:
  // remember that this key is down
  g0=1
  // if key "Y" is not down, ignore this message
  if g1==0 then exit rules, skip Outgoing Action
  // otherwise execute outgoing action
Outgoing: Note On Z
  Note On on channel 1 with note:64 (0x40) and velocity:pp

[x] Translator 0.1: Up X
Options: swallow
Incoming: Note Off X
  Note Off on channel 1 with note:60 (0x3C) set 'pp' to velocity
Rules:
  // remember that this key is up
  g0=0
  // if key "Y" is not down, ignore this note off
  if g1==0 then exit rules, skip Outgoing Action
  // otherwise execute outgoing action
Outgoing: Note Off on channel 1 with note:64 (0x40) and velocity:pp

[x] Translator 0.2: Down Y
Options: swallow
Incoming: Note On Y
  Note On on channel 1 with note:62 (0x3E) set 'pp' to velocity
Rules:
  // remember that this key is down
  g1=1
  // if key "X" is not down, ignore this message
  if g0==0 then exit rules, skip Outgoing Action
  // otherwise execute outgoing action
Outgoing: Note On Z
  Note On on channel 1 with note:64 (0x40) and velocity:pp

[x] Translator 0.3: Up Y
Options: swallow
Incoming: Note Off Y
  Note Off on channel 1 with note:62 (0x3E) set 'pp' to velocity
Rules:
  // remember that this key is up
  g1=0
  // if key "X" is not down, ignore this note off
  if g0==0 then exit rules, skip Outgoing Action
  // otherwise execute outgoing action
Outgoing: Note Off Z
  Note Off on channel 1 with note:64 (0x40) and velocity:pp
Variable g0 is used to remember if Note X (in this example: C4) is down (1) or up (0). Variable g1 is the same for Note Y (in this example: D4). Now if you press X, it sets g0 to 1 and checks the value of g1: if the latter is 0 (i.e. Y is not pressed), nothing is done. If g1 is 1 (Y is pressed, too), fall through the Rules section and execute the outgoing action: Note On Z (in this example: Note E4).

Similar logic is used for releasing Note X: the outgoing action, Note Off Z, is only executed when Note Y is still down.
The same logic is used for Note Y.

If you want to define multiple X/Y/Z triplets, make sure to replace g0 and g1 with other global variables (two-letter variables g0...g9, ga...gz, and the same with first letter h,i,j,k,...).

Hope this makes sense! Attached the project file.
Florian
Attachments
Output Z only if X and Y down.bmtp
(2.78 KiB) Downloaded 103 times

4225jon

2016-02-02 22:04:34

Many thanks Florian-to put a bit of meat around the bare bones of my request re: (x+y)=Z ,for possible members interest.
"Arranger" K/Boards play accomp. "style" (midifile) based on the harmony keyed in to assigned portion of the lower K/b.
The options are "single note" (1/12),or "fingered" (3or4/12),depending on the complexity of the desired harmony. So,say we
want a C7b9, 4 notes must be keyed,-to avoid wrong root being played. My idea would always play the BASSroot C (noteZ) for
ANY of the C7 extensions as long as E (noteX),and Bb (noteY),are present. This works beautifully on a multinote string pad,
and even more on a minimal 2 note piano/organ comp. Florian has already deduced there needs to be a(limited) set of
translators to complete the picture,so I'd better get down to it,and post results back.The idea works in practice,due to the midi
assignability of my late current model PSR. I can post again to any interested members,probably jazzers......."
jonW.