Filter by MIDI Channel

florian

2012-08-02 23:23:39

A user wants to filter channels 3 to 15, and only let through channels 1 and 2.

florian

2012-08-02 23:27:32

The first solution is sort of simple, it does not use rules.

- manually pass through channels 1 and 2
- swallow all others.

Code: Select all

Translator 0: Pass Through Note Off Channel 1
Options: stop=true
Incoming: MIDI 80 pp qq
Outgoing: MIDI 80 pp qq

Translator 1: Pass Through Note On Channel 1
Options: stop=true
Incoming: MIDI 90 pp qq
Outgoing: MIDI 90 pp qq

Translator 2: Pass Through Controllers Channel 1
Options: stop=true
Incoming: MIDI B0 pp qq
Outgoing: MIDI B0 pp qq

Translator 3: Pass Through Note Off Channel 2
Options: stop=true
Incoming: MIDI 81 pp qq
Outgoing: MIDI 81 pp qq

Translator 4: Pass Through Note On Channel 2
Options: stop=true
Incoming: MIDI 91 pp qq
Outgoing: MIDI 91 pp qq

Translator 5: Pass Through Controllers Channel 2
Options: stop=true
Incoming: MIDI B1 pp qq
Outgoing: MIDI B1 pp qq

Translator 6: Swallow all other MIDI messages
Options: stop=true
Incoming: MIDI rr pp qq
Outgoing: (none)
Here is the preset file:
PassThrough Channels 1 and 2, A.bmtp
(1.34 KiB) Downloaded 268 times
Also make sure you have the MIDI ports set up correctly.
No need for routing in Midi Translator's MIDI Router.

Florian

florian

2012-08-02 23:35:35

The second solution uses rules. For many people, rules are difficult to come up with, but as you can see, it's much more elegant.

Code: Select all

Translator 0: Swallow channels 3-15
Options: stop=true
Incoming: MIDI rr pp qq
Rules: 
  tt=rr&15
  if tt<=1 then exit rules, skip Outgoing Action
Outgoing: (none)

Translator 1: Pass Through channels 1-2
Options: stop=true
Incoming: MIDI rr pp qq
Outgoing: MIDI rr pp qq
The trick is to extract the channel from the first MIDI status byte (variable rr): by using the AND operator (&), tt will be set to the channel value of the incoming MIDI message, 0...15. The next line simply directs MIDI Translator to not execute this translator entry if the channel is lower or equal than 1 (which maps to MIDI Channel 2). If the translator is executed, the Outgoing action will be executed, which means: do not output this MIDI message. The "stop processing" option is also important, it means that processing will stop for channels 3..16 after executing the "None" outgoing action.
All remaining MIDI messages are caught in the second translator, which will just forward all 3-byte MIDI messages.
This preset is also attached:
PassThrough Channels 1 and 2, B.bmtp
(863 Bytes) Downloaded 260 times
Florian