MIDI Controller sends quirky Controller events - is it possible to create MIDI Bindings?

I’m in the process of trying to write a MIDI Binding Map for an old Keyboard with various controls and buttons.

I’ve been able to work around many of the devices idiosyncrasies - but there are two that I have not been able to find a solution.

The first are a row of buttons which sends two controller events using all the same controller number - only the values define the button number. I was hoping to map these buttons to “uri=”/route/mute X". Does anyone have any ideas on how to bind these?

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

The second is a Jog Wheel which sends controller events using the same controller number - only the 2nd event value defines the direction of the Jog Wheel.

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

For the buttons is there a way to match on the event parameter value? Something like:

<Binding channel="1" ctl="30" value="1" uri="/route/mute B1"/>
<Binding channel="1" ctl="30" value="3" uri="/route/mute B2"/>
<Binding channel="1" ctl="30" value="5" uri="/route/mute B3"/>

For the Jog Wheel is there a way to match on the 2nd Controller Event value? Something like:

<Binding channel="1" ctl="112" cmd="2nd" value="63" action="Editor/select-prev-route"/>
<Binding channel="1" ctl="112" cmd="2nd" value="65" action="Editor/select-next-route"/>

I’ve read the appropriate sections of the online manual and have read through all the submitted MIDI Binding templates on Github.

I’ve tried msg=“” but have not been able to get any of my variations to work. There are two examples in the online manual but there are about a few different variations in the Github templates. Some with a separate"channel=" and others without.

Can anyone provide any pointers or suggestions on how to match these quirky Controller events?

Replying to myself…

For the Jog Wheel - I’ve found a solution. The missing info - I didn’t realise regarding use of msg=“” is that Controller Change starts with “b_”… So channel 1 would be “b0”. This wasn’t obvious to me when reading the manual examples or when reading the MIDI Tracer output.

For anyone else in the same situation - I found this handy MIDI command string website

So for the Jog Wheel - I now have the following working.

<Binding msg="B0 70 3f" action="Common/playhead-backward-to-grid"/>		<!-- Big Knob Rotate Left -->
<Binding msg="B0 70 41" action="Common/playhead-forward-to-grid"/>		<!-- Big Knob Rotate Right -->

For the buttons - I have now identified a working match… but have run into the limitations of Ardour uri=“” Control Addresses.

<Binding msg="B0 1e 05" uri="/route/solo B3"/>				<!-- Button -->

Is there anything equivalent or an alternative to do the same thing with “actions” or “functions”? I’ve looked at “Monitor/monitor-solo-1” for example but have not been able to get a similar behaviour to “/route/solo B3”.

By any chance does anyone have any suggestions or ideas?