MIDNAM file format: How do I find the MIDI commands to switch between keyboard modes?

I’m working on a MIDNAM file for my keyboard (Korg Kross 2). I plan to share the finished version for inclusion in future versions of Ardour.

When reviewing other MIDNAM files bundled with Ardour, I noticed that the Korg_Wavesation_SR.midnam includes some MIDI commands.

    <CustomDeviceMode Name="Mode 2">
      <DeviceModeEnable>
        <MIDICommands>
          <SysEx>F0 42<SysExDeviceID Offset="30"/> 28 41 04 00 2B 32 00 F7</SysEx>
        </MIDICommands>
      </DeviceModeEnable>

My assumption is these MIDI commands enable specific modes on the keyboard. Is that correct?

My keyboard has a “Programs” mode with a full set of sound banks plus a “Combinations” mode with another (overlapping) set of sound banks.

Is there a way I can find or detect the equivalent MIDI commands on my keyboard? It would be nice if Ardour could instruct the keyboard to switch between “Programs” mode and “Combinations” mode.

I don’t know what you mean by specific modes. This is the WS Parameter Change message to change the MIDI mode in the Wavestation - as in Mono/Poly/Multi Mode, which are defined by MIDI standard and decide how data received on different MIDI channels gets interpreted.

If you have the manual for your keyboard, and it has the MIDI implementation specification, you should be able to find what you need to send.
You can compare the Korg data in appendix 4 of the manual with what Ardour has listed in the MIDNAM file:
Download page for Wavestation SR manual

Starts on page 166.
That section starting with “28 41 …” is a parameter change message (page 171). You have to find where the parameters are defined to see what the values mean. Section 5.10 and later starting on page 180 give the details. Looks kind of tedious to me, I’m not going to go through every byte and decode it right now, but that should get you started.

I didn’t find an equivalent section in my keyboard’s manuals, so I removed that section from the Midnam file and submitted a pull request to Ardour with what I do have.