Can midish match on CC number and parameters and then change the outgoing CC number?

From: midish _at_ oijn <midish_at_oijn.uk>
Date: Mon, 17 Nov 2025 22:36:23 +0000
I have a MIDI Piano keyboard that for reasons only the 
designers/developers of the piano understand.  Some of the piano 
keyboard controls on the left side of the keyboard are note events 
presented on one ALSA MIDI port.  While the keyboard controls on the 
right side of the keyboard are CC events which also share the notes from 
the piano keyboard which are presented on another ALSA MIDI port.  Where 
the keyboard left side controller note events conflict with the piano 
note events.

I've found that most software like DAWs or Sequencers or Notation either 
expect the (1) Piano keyboard note events on one ALSA MIDI port only; 
with control events on another ALSA port separate from the note events 
(Ardour for example).  Or the software expects (2) everything - note 
events and control events all mixed on only one ALSA MIDI port 
(Musescore for example).

Also known only to the Piano keyboard designers/developers is why they 
decided for many of the piano control buttons to use a single CC number 
and differentiate the buttons by just the parameter values. Example:

Button 1
     Controller chn  1 1e 01
     Controller chn  1 1e 00
Button 2
     Controller chn  1 1e 03
     Controller chn  1 1e 02
Button 3
     Controller chn  1 1e 05
     Controller chn  1 1e 04
Knob Rotate Left
     Controller chn  1 70 40
     Controller chn  1 70 3f
Knob Rotate Right
     Controller chn  1 70 40
     Controller chn  1 70 41

What I have been looking for is a MIDI router/filter/transform utility 
that would go between the physical ALSA MIDI ports and the software 
input MIDI ports and be able to sort out the mess.

For scenario (1) above where all controller events are to be routed to 
one ALSA MIDI port; while all piano note events are to be routed to 
another separate ALSA MIDI port - I've been able to get midish to do 
exactly that with the following config:

dnew 0 "28:1" rw #DAW
dnew 1 "28:0" rw #MIDI
dnew 2  nil   rw #Keyboard
dnew 3  nil   rw #Controllers

fnew sort_events
  fmap   {any 1}   {any 2} #MIDI to Keyboard
  fmap   {any 0}   {any 3} #DAW  to Controllers
  fmap   {rpn 1}   {rpn 3} #MIDI to Controllers
  fmap  {nrpn 1}  {nrpn 3} #MIDI to Controllers
  fmap  {xctl 1}  {xctl 3} #MIDI to Controllers
  fmap   {ctl 1}   {ctl 3} #MIDI to Controllers
  fmap {ctl 1 1} {ctl 2 1} # Mod to Keyboard


For scenario (1) I've now run into a challenge - as to how to match and 
transform the button controller events so that they become separate CC 
numbers; ideally with more standard parameters.  However, I think as 
long as the CC numbers are different it should still work with 
associated software.

By any chance is there a way in midish to match on CC number and 
parameters and then change the outgoing CC number? and ideally change 
the parameters to be more standard?  Something like:
#fmap {ctl 0 30} 2   {ctl 3 31} 127
#fmap {ctl 0 30} 1   {ctl 3 31} 0
#fmap {ctl 0 30} 3   {ctl 3 32} 127
#fmap {ctl 0 30} 2   {ctl 3 32} 0
#fmap {ctl 0 30} 5   {ctl 3 33} 127
#fmap {ctl 0 30} 4   {ctl 3 33} 0


For scenario (2) is there a way to transform note events to CC events so 
that the left side of the keyboard controllers won't conflict with the 
piano keyboard note events when all left-side and right-side controller 
and piano note events are combined together to only one ALSA MIDI port?

Something like:
#fmap {note 1}  {ctl 3}


Thanks for your time.
Received on Mon Nov 17 2025 - 23:36:23 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 18 2025 - 01:30:01 CET