# MIDI Filter Rule Sytem (it was "Disable program change reception?")

**URL:** <https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165>\
**Category:** Software\
**Created:** [September 27, 2017, 10:02pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165 "2017-09-27T22:02:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hampelschwein](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/h/eb8c5e/32.png) [@Hampelschwein](https://discourse.zynthian.org/u/Hampelschwein)\
**Post date:** [September 27, 2017, 10:02pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/1 "2017-09-27T22:02:48Z")

</div>

I use the Zynthian with the keyboard of a dsi mopho synth. Unfortunately the editing of the global parameters for sending midi parameters or midi messages does not really seem to work, so i cannot disable that the progam changes are beeing sent. which is very annoying because in my live setup I want to use sounds from the zynthian aswell as sounds from the mopho and change between the two by running the zynthian into the audio in of the mopho and selecting the zynthian by switching to a preset where the audio-in is active (which now unfortunately also changes the preset in the zynthian, so I would always have to reset the zynthian sound that i wanted to play).

---

<div class="post-metadata">

**Author:** ![mheidt](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/mheidt/32/773_2.png) [@mheidt](https://discourse.zynthian.org/u/mheidt)\
**Post date:** [September 27, 2017, 11:05pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/2 "2017-09-27T23:05:06Z")

</div>

@jofemodo  
We could have checkboxes in the midi section of the webconf for every cc group.

Besides. Does anybody else has an issue with KeyUp after a PitchBend? That it has the pitch of the key and not the bent key? It could be my keyboard…have to test with another one as well before I debug 🙂

---

<div class="post-metadata">

**Author:** ![mheidt](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/mheidt/32/773_2.png) [@mheidt](https://discourse.zynthian.org/u/mheidt)\
**Post date:** [September 28, 2017, 7:03am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/3 "2017-09-28T07:03:50Z")

</div>

like this?

 ![MidiFilter](https://discourse.zynthian.org/uploads/default/original/1X/753fba2f4cf2cd90227a77f321da4831b8f249bc.png)

---

<div class="post-metadata">

**Author:** ![mheidt](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/mheidt/32/773_2.png) [@mheidt](https://discourse.zynthian.org/u/mheidt)\
**Post date:** [September 28, 2017, 7:06am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/4 "2017-09-28T07:06:35Z")

</div>

While we are at it, we could implement a cc message translation as well:  
breath to modulation:  
2=1, other translations

> [@TEControl Breath Controller and Zynthian](https://discourse.zynthian.org/t/tecontrol-breath-controller-and-zynthian/1112/5):
>
> I suppose the actual question is rather whether any of the softsynths/patches respond to midi CC breath/expression/pressure or whatever the TECcontrol is configured to send. (I have the BITE version of the TECcontrol and it has a PC/MAC app for configuring the firmware) There’s an interesting tangent - I hope to get a Zynthian cobbled together eventually to run with my MPE controller (Linnstrument), and technically that’s all well and good but only really meaningful if there’s a substantial amo…

Maybe not a filter like in the previous screenshot, but

Translate CC events (1011) (i.e. 2=1,4=OFF)

---

<div class="post-metadata">

**Author:** ![gmeader](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/gmeader/32/607_2.png) [@gmeader](https://discourse.zynthian.org/u/gmeader)\
**Post date:** [September 28, 2017, 5:38pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/5 "2017-09-28T17:38:42Z")

</div>

“Filter” is technical jargon. I would use “Ignore” to clearly describe what will happen if you check the box.

What do the 4 digits in parentheses mean?

What exactly is supposed to be entered in the text field labelled “Filter CC events (1011)(comma separated)”? Could you provide a couple of examples?

(I am trying to document all this stuff…)

---

<div class="post-metadata">

**Author:** ![mheidt](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/mheidt/32/773_2.png) [@mheidt](https://discourse.zynthian.org/u/mheidt)\
**Post date:** [September 28, 2017, 6:47pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/6 "2017-09-28T18:47:24Z")

</div>

The numbers are for @jofemodo. He knows what to do with it. In the final layout, they are gone.  
The 2=1 means, that Breath Control CC 2 messages are translated into CC 1 modulation messages.  
All fields are expert fields. In the future we will have a switch to be able to hide them.

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [September 29, 2017, 8:48am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/7 "2017-09-29T08:48:15Z")

</div>

OK! I like the idea, but we should think of creating the mechanism for hidding the advanced fields. The list getting too long … A little bit of javascript will do the trick quite easily. JQuery library is already included … 😉

Also, i prefer using “Ignore” better than “filter”. The “translate CC” option is nice too.  
All this options would be “global”, applied to all channels. I’m working in the “per-channel translate CC”, but would be presented as a “MIDI learn” feature that will be stored with the “snapshot”.

Regards!

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [September 29, 2017, 9:02am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/8 "2017-09-29T09:02:58Z")

</div>

- Regarding the “ignore” feature, perhaps it could be presented as a “multi-select” widget?
- Perhpas the “translate” feature could be a “textarea”, and we can define a small script-language for MIDI filtering.

Something like that:

> IGNORE PG  
> IGNORE CH#6:9 KP  
> IGNORE CH#6 CP  
> IGNORE PB  
> IGNORE CC#4  
> IGNORE CH#5:8 CC#16,17  
> TRANS CC#5 =\> CC#18  
> TRANS CH#4 CC#76 =\> CC#87

Where event types code are:

- PG =\> Program change
- KP =\> Polyphonic Key Pressure (Aftertouch)
- CP =\> Channel Pressure (Aftertouch)
- PB =\> Pitch Bending
- CC =\> Continuous Controller Change

Regards,

---

<div class="post-metadata">

**Author:** ![mheidt](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/mheidt/32/773_2.png) [@mheidt](https://discourse.zynthian.org/u/mheidt)\
**Post date:** [September 29, 2017, 11:31am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/9 "2017-09-29T11:31:49Z")

</div>

I like the idea of the script-language.  
the “multi-select” widget could be a panel of inputs which create those commands.

1. select Command [IGNORE|TRANS]
2. MutliSelect Channel [ALL (0), 1-16]
3. Select MidiEvent [PG…CC]  
If MidiEvent is CC, the following will be displayed as well
4. MultiSelect CCValue [1…127?]  
If command is TRANS and only one CCValue is selected, the following is displayed:
5. MultiSelect TranslatedCCValue [1…127?]

Or do you want to be able to translate a CC#76 to a KP or sth else as well?  
In this case, we need a TranslatedMidiEvent as well.

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [September 29, 2017, 11:53am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/10 "2017-09-29T11:53:31Z")

</div>

Yes, “translated MIDI event” too … why not? 😉

Note: The filter script should be “stored” in a single environment variable (command/line). Do you agree?

---

<div class="post-metadata">

**Author:** ![mheidt](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/mheidt/32/773_2.png) [@mheidt](https://discourse.zynthian.org/u/mheidt)\
**Post date:** [September 29, 2017, 11:59am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/11 "2017-09-29T11:59:59Z")

</div>

We need to talk about the range a little.  
Should this be possible as well?  
5:8,13,14:16

Do we really want to make it more complicated than necessary?  
Or are we happy with the comma separated notation? In the end there are only 16 values…15…16 would be 0 🙂

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [September 29, 2017, 12:00pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/12 "2017-09-29T12:00:03Z")

</div>

I’m happy because we have the first practical application for the MIDI-OUT connector. Zynthian could be used as a standalone MIDI filter device …nice!!! 🕶

Regards!

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [September 29, 2017, 12:02pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/13 "2017-09-29T12:02:45Z")

</div>

It’s not so complex … i will code the “parser” as a python library, so you don’t need to worry about it 😉

Regards!

---

<div class="post-metadata">

**Author:** ![mheidt](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/mheidt/32/773_2.png) [@mheidt](https://discourse.zynthian.org/u/mheidt)\
**Post date:** [September 29, 2017, 12:06pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/14 "2017-09-29T12:06:56Z")

</div>

I have to fill the textarea… It’s an additional step for me to optimize a list to this shorter form…or i don’t.

The challenge for me will be to code this in pure javascript, because I don’t want to break the config-block.html structure.  
BTW.

---

<div class="post-metadata">

**Author:** ![Hampelschwein](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/h/eb8c5e/32.png) [@Hampelschwein](https://discourse.zynthian.org/u/Hampelschwein)\
**Post date:** [September 30, 2017, 8:59am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/15 "2017-09-30T08:59:33Z")

</div>

so great you guys are already working on this!  
would be also nice to have the mod wheel separately de/selectable

---

<div class="post-metadata">

**Author:** ![mheidt](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/mheidt/32/773_2.png) [@mheidt](https://discourse.zynthian.org/u/mheidt)\
**Post date:** [October 1, 2017, 1:16am UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/16 "2017-10-01T01:16:01Z")

</div>

@jofemodo, the github branch is githubNo19

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [October 5, 2017, 2:41pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/17 "2017-10-05T14:41:34Z")

</div>

Hi @zynthianters!

I’ve extended the MIDI filter core functionality. Now it’s possible to map almost any event in any channel to any event in the same or different channel. Note-on/off events are not supported supported right now, but it could be done quite easily if you think it’s interesting.

In order to easily configure the filter, a simple rule system has been implemented. You can take a look to the parse here:

> <https://github.com/zynthian/zynthian-ui/blob/master/zyngine/zynthian_midi_filter.py>

This functionality will be available from the webconf tool. @mheidt is finishing the integration 😉

Enjoy!

---

<div class="post-metadata">

**Author:** ![Hampelschwein](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/h/eb8c5e/32.png) [@Hampelschwein](https://discourse.zynthian.org/u/Hampelschwein)\
**Post date:** [October 9, 2017, 7:38pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/18 "2017-10-09T19:38:58Z")

</div>

thanks fernando!  
It’s not yet doable without the webconf integration did i get that right?  
Looking forward to it, this will be so useful for me!

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [October 29, 2017, 7:00pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/19 "2017-10-29T19:00:12Z")

</div>

Hi @Zynthianers!

Finally we have the new “MIDI Filter Rule System” feature integrated in the webconf tool. You can create your rules by hand or using the wonderful “rule composition” dialog.

As you probably remember, we have developed a simple “MIDI Filter Rule Language” that can be used for creating rule sets (scripts) that can do a lot of interesting tricks with your MIDI input flow. If you have a MIDI-OUT (like the new Zynthian Kits v2 have), you can use your Zynthian Box as a powerful standalone MIDI filter.

Here is the MIDI Filter Rule Language syntax:

> Rule Formats:
> 
> - IGNORE [CH#??] EV[#??]
> - MAP [CH#??] EV[#??] =\> [CH#??] EV[#??]
> - CLEAN [CH#??] EV[#??]
> 
> Event types:
> 
> - PG =\> Program Change
> - KP =\> Key Press (after-touch)
> - CP =\> Channel Press (after-touch)
> - PB =\> Pitch Bending
> - CC#?? =\> Continuous Controller Change (??=controller number)
> 
> Numeric expressions:
> 
> - 5 =\> a single number
> - 5,6,7 =\> a list of numbers
> - 5:7 =\> a range of numbers, including both limitters
> - 1,2,3:5 =\> a mix of lists and ranges
> 
> Some Examples:
> 
> - IGNORE CH#2 PG =\> It will ignore Program Change events coming from channel 2
> - MAP CH#1 CC#7 =\> CC#1 =\> It will translate Volume Control events from channel 1 to Modulation Wheel events in the same channel
> - MAP CH#1 CC#0:127 =\> CH#2 CC#0:127 =\> It will translate all the CC (Continuous Controller) events from channel 1 to channel 2

Thanks to @mheidt who have done the webconf integration and help me a lot testing the parser. I love you man 😍

Enjoy!

---

<div class="post-metadata">

**Author:** ![Hampelschwein](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/h/eb8c5e/32.png) [@Hampelschwein](https://discourse.zynthian.org/u/Hampelschwein)\
**Post date:** [October 29, 2017, 9:10pm UTC](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165/20 "2017-10-29T21:10:53Z")

</div>

Cool thank you guys!  
Only where do I find the rule composition dialog? I cant see it in nowhere in the webconf? And I dont know how/where to do it by hand.

[Next page](https://discourse.zynthian.org/t/midi-filter-rule-sytem-it-was-disable-program-change-reception/1165.md?page=2)
