computer keystoke changing midichannel - need help

orangefx

2007-12-12 23:34:56

hi all
my usb-midi controller sends on channel 1, i want it to send on channel 2 after hitting any uneven number (1;3;5;7;9) on my laptop keyboard. after pressing any even number (2;4;6;8;0) on my keyboard the rule should be dropped (meaning the controller should be sending on channel 1 again).

how can i do that?

florian

2007-12-14 17:23:41

Hi,

for this you need Midi Translator Pro or Author.
Then, one easy way to do it is to create 3 Translator entries:
1) monitor the 1 key and set the global variable gc to 1
2) monitor the 2 key and set the global variable gc to 0
3) filter MIDI messages and replace the channel with gc

Code: Select all

Translator 1: New Translator
Options: stop=false
Incoming: Keystroke: 1
Rules: 
  gc=1
Outgoing: (none)

Translator 2: Key 2: set gc to 0
Options: stop=false
Incoming: Keystroke: 2
Rules: 
  gc=0
Outgoing: (none)

Translator 3: Filter MIDI messages
Options: stop=false
Incoming: MIDI pp qq rr 
Rules: 
  Label "Ignore system messages"
  if pp>=240 then exit rules, execute Outgoing Action
  pp=pp&240
  pp=pp|gc
Outgoing: MIDI pp qq rr 
The rules in the third translator seem a bit complicated. All they really do is to replace the channel component of the first byte with gc.

If you want to support 2-byte messages, too (e.g. program change), then add a 4th translator as a duplicate of the 3rd translator and replace "pp qq rr" with "pp qq".

Duplicate the first 2 translators and edit appropriately to support the keys 3,4,5,etc.

Let us know how it works for you.
Regards,
Florian

orangefx

2007-12-15 10:27:11

hi florian
thanx for quick reply. i think i got everything right as u told me. i activated all 3 translators and opened midi-ox as monitor afterwards. there i cannot see any difference. incoming messages (midiyoke 1) come always on channel 1, regardless of any keys pressed on my keyboard. whats wrong?

greets
orange

florian

2007-12-15 10:40:45

I forgot to say: MT is not a direct filter, you need to "daisy chain" it into the MIDI path:
MIDI Device -> Midi Translator -> MIDI-OX

For the first connection, just open the MIDI Device as MIDI IN in Midi Translator's menu. For the second connection, use a virtual MIDI cable like LoopBE1, Maple, or Yoke. Select one virtual port in MT's MIDI OUT, and select the same virtual port as MIDI IN in MIDI-OX (or whatever software you're using).

MT's MIDI IN and MIDI OUT lights need to blink upon activity. Use the Options|Log Window in MT to verify what MT is doing.

Hope that makes sense!

Regards,
Florian

orangefx

2007-12-15 12:00:11

i chained it as u said
For the first connection, just open the MIDI Device as MIDI IN in Midi Translator's menu. For the second connection, use a virtual MIDI cable like LoopBE1, Maple, or Yoke. Select one virtual port in MT's MIDI OUT,
i used yoke 1
and select the same virtual port as MIDI IN in MIDI-OX (or whatever software you're using).
used yoke 1 here too.

this is the log:
IN : Keystroke: 1
IN : MIDI 90 33 7F, pp=0x90 qq=0x33 rr=0x7F
assignment: (pp=pp&240) = 144
assignment: (pp=pp|gc) = 144
OUT: MIDI 90 33 7F
IN : MIDI 90 33 00, pp=0x90 qq=0x33 rr=0x00
assignment: (pp=pp&240) = 144
assignment: (pp=pp|gc) = 144
OUT: MIDI 90 33 00
IN : Keystroke: 2
IN : MIDI 90 33 7F, pp=0x90 qq=0x33 rr=0x7F
assignment: (pp=pp&240) = 144
assignment: (pp=pp|gc) = 144
OUT: MIDI 90 33 7F
IN : MIDI 90 33 00, pp=0x90 qq=0x33 rr=0x00
assignment: (pp=pp&240) = 144
assignment: (pp=pp|gc) = 144
OUT: MIDI 90 33 00

florian

2007-12-15 12:40:00

Hi,

it seems there is a small mistake in your first translator -- as you can see in the log, after "Keystroke 1" nothing is executed. I would have expected an assignment gc = 1. Please check the rules of Translator 1.

Regards,
Florian

orangefx

2007-12-15 14:09:30

:idea:
WORKING!
THANX A LOT AND HAVE A NICE X-MAS!
:D

orangefx

2007-12-15 19:16:33

florian,
i made a preset with the pro demo for the numbers 1;2;3;4....0, following ur instructions. this preset is the only thing i will ever need the pro version for. is it possible to upload it, so u can maybe add it to the presets of the player?
please?
:roll:

florian

2007-12-16 20:22:05

Hi orangefx,

I acknowledge that purchasing a Pro license is quite a lot for your use case.

On the other hand, you'll understand that there has to be some incentive to purchase the Pro edition (or the Author edition)...

And keep in mind: with a license of MT Pro, you don't only pay for the program itself, but also for the support... which you've enjoyed already
:wink:

Hope you understand!
Regards,
Florian