How can I parse similar sysEx dump in two different ways?

For the Kawai K4 I’d like to parse a “one single data dump” as well as a “one multi data dump”.

A “one single data dump” contains all parameter data for a single patch and has 130 bytes in its payload. Parsing already is set up using the standard E1 parsing way.

A “one multi data dump” contains however the data to define how up to 8 different patches should be used in a multitimbral set up. It does not contain patch parameter data. It has 76 bytes in its payload.

But now I see the dump request and the dump itself have the same header for both message types, the only difference being the “patch no” (in screen shot below, called"Sub Status 2"), whereby Single data dumps have a number between 0-63 (so anything starting with 00xxxxxx) and Multi data dumps have a number between 64-127(so anything starting with 01xxxxxx) .
(Be aware Sub Status 1 can be 00H or 02H depending if the single or multi is found in internal memory or on the memory card).

Is there an easy way I can still use the standard E1 parsing method for both messages, allthough the header data is the same and parsing is completely different ?

Here’s how the header is currently set up in E1.

One thing I do is in the Lua code for patch.onResponse() is that I check the receive size of the sysex block.

function patch.onResponse (device, responseId, sysexBlock)
   local recvSize = sysexBlock:getLength ()

   if (recvSize == 149) then
-- process a single dump
   elseif (recvSize == 18468) then
-- process a multi-dump
   else
-- print out a message
   end

That way I can use the same generic header rpefix in the definition (as you do) and still handle all kinds of data that comes back from the device.

Thx,
then how do you go about differentiating the two different responses in the E1 editor?
Because I would not to build two response then, each with the same header (cfr screen shot)

Ooofff - that is out of my league. :thinking:

I have never used the actual editor to parse MIDI sysex data. I always used Lua. Partly because the editor was not able to handle the variety of formats in the beginning and partly because I find Lua faster and more flexible to code. I was always clicking on the wrong bits and/or putting numbers in the wrong place with the GUI.

I don’t know how to skip over sections or branch around things in the editor UI (if that is even possible).

Otherwise, you would need to define 2 different headers using more of the data bytes to tell them apart. Then add in the parsing fields and bits (like you have) for each of the headers.

1 Like

Fair enough. Then I’ll try the following; I’ll keep the parsing of single data dumps as it is, since it is already built.

But via midi.onSysex I’ll capture the multi data dump and process it through lua (at that moment the patch parameters will be parsed incorrectly), immediately followed by a single data dump request for the currently chosen timbre within the multi. That way , both the multi parameters will be meaning full as the patch parameters.

Cross your fingers !

1 Like

I am afraid that the “static” JSON based parser will not be able to handle that.

1 Like

No worries, I resolved it via lua