Home › Forums › General › Programming › Midi Input Overload on Multiple Sysex Dump Requests
- This topic has 5 replies, 4 voices, and was last updated 3 years, 2 months ago by
goodweather.
-
AuthorPosts
-
September 28, 2020 at 4:13 am #120069
Hey guys,
So in my panel I have a function that is requesting a bunch of program/patch/overlay dumps. The request is being incremented by one value in the sysex string of a for loop for the desired amount of requests. If I send any one of these requests individually the dump with be received fine to then store (and is shown in the midi monitor), however when I have them being sent in the loop I will only receive 3 – 4 of the 25 requested dumps, which leads me to believe that the problem is with issuing all of these requests simultaneously and the midi input is being overloaded.
I’ve looked into this a bit on the forum but I’m struggling to find out exactly how I should tackle this issue. Could anyone suggest the best method of doing either a delay/wait/sleep of however long between each message or a way of knowing that each dump has been received before iterating through the loop and sending the next request?
Cheers
September 28, 2020 at 5:59 am #120070Hi Jsh,
Try:
os.execute(sleep(125))
Between messages you want to delay.
Here the delay is
125=Milliseconds for exampleSeptember 29, 2020 at 8:06 pm #120078Hmmm,
I tried using this in my code but I’m still only getting 3 of the 25 dumps in the midi monitor; I’m getting different dumps now, always numbers 16, 17 & 18, but not the desired result. Any ideas what might be happening. Here is my code:
-- -- Called when a modulator value changes -- @mod http://ctrlr.org/api/class_ctrlr_modulator.html -- @value new numeric value of the modulator -- RequestOverlayDump = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source) local hexValues = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18} for _,v in pairs(hexValues) do os.execute(sleep(125)) local requestMsg = CtrlrMidiMessage({0xF0, 0x00, 0x20, 0x29, 0x00, 0x33, 0x00, 0x4F, v, 0xF7}) panel:sendMidiMessageNow(requestMsg) end end
I have also tried using different times, i.e.
os.execute(sleep(300))
etc, as well as having the sleep after sending the midi message but with no luck.Here is what the midi monitor shows:
midi out:
[06:47:52:000398]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 00 f7] [06:47:52:000699]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 01 f7] [06:47:53:000000]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 02 f7] [06:47:53:000300]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 03 f7] [06:47:53:000600]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 04 f7] [06:47:53:000901]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 05 f7] [06:47:54:000201]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 06 f7] [06:47:54:000502]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 07 f7] [06:47:54:000802]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 08 f7] [06:47:55:000103]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 09 f7] [06:47:55:000404]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 0a f7] [06:47:55:000704]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 0b f7] [06:47:56:000006]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 0c f7] [06:47:56:000306]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 0d f7] [06:47:56:000606]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 0e f7] [06:47:56:000907]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 0f f7] [06:47:57:000208]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 10 f7] [06:47:57:000509]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 11 f7] [06:47:57:000809]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 12 f7] [06:47:58:000110]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 13 f7] [06:47:58:000411]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 14 f7] [06:47:58:000712]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 15 f7] [06:47:59:000013]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 16 f7] [06:47:59:000314]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 17 f7] [06:47:59:000614]: Size:[ 10] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4f 18 f7]
midi in:
[06:56:05:000059]: Size:[ 106] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4e 16 00 00 00 24 02 01 53 00 01 10 08 0c 04 00 00 40 21 47 50 00 01 7f 31 59 71 40 00 00 02 38 00 00 04 10 00 04 30 00 00 00 20 00 08 60 00 00 00 00 00 00 09 31 48 00 00 00 00 0d 03 10 12 29 00 40 40 20 10 04 02 01 01 00 20 10 08 04 02 01 00 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 f7] [06:56:05:000360]: Size:[ 106] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4e 17 00 00 00 24 02 03 41 00 01 10 08 08 04 00 00 40 21 4d 30 00 01 7f 7f 51 71 08 00 00 00 48 2e 0d 04 10 05 15 68 00 00 00 20 0a 2b 50 00 00 00 00 00 00 09 31 48 00 00 00 00 0d 03 10 12 29 00 40 40 20 10 04 02 01 01 00 20 10 08 04 02 01 00 5a 02 42 20 00 00 00 00 00 00 00 00 00 00 00 00 02 f7] [06:56:05:000660]: Size:[ 106] Ch:[--] No:[----] Val:[----] RAW:[f0 00 20 29 00 33 00 4e 18 00 00 00 24 02 02 6d 00 01 10 08 0d 34 00 00 40 21 45 10 00 01 7f 7f 51 78 07 40 00 00 40 2a 0d 04 10 04 15 68 00 00 00 20 08 2b 50 00 00 00 00 00 00 09 31 48 00 00 00 00 0d 03 10 12 29 00 40 40 20 10 04 02 01 01 00 20 10 08 04 02 01 00 67 02 42 20 00 00 00 00 00 00 00 00 00 07 7f 7f 7f f7]
Cheers.
September 29, 2020 at 10:54 pm #120079Novation Bass Station II ??
You are trying to export an overlay? Are you sure the other note overlays aren’t blank?
On another note: Why the hex table?
I think you can do:
for i = 0,24 do
local requestMsg = CtrlrMidiMessage({0xF0, 0x00, 0x20, 0x29, 0x00, 0x33, 0x00, 0x4F, i, 0xF7}) panel:sendMidiMessageNow(requestMsg)
os.execute(sleep(125))
endSeptember 30, 2020 at 7:30 pm #120086Yeah the default note overlays in overlay banks 2, 3, 4 and 5 are all full, and if requested individually return fine. I kinda figured as I was doing the hex table that it was bound to be unnecessary / wrong but I assumed it had to be in hex for whatever reason. Ultimately still having the same issue though after removing the unnecessary weird formatting / looping. Having the os.execute(sleep(125)) just seems to pause everything once (for longer than 125ms) and then do the same initial behavior afterwards rather than after each message?
Cheers
September 30, 2020 at 9:43 pm #120087Hi,
using the sleep method is not too good because relying on the OS and I remember having issues with that.
The method is to use a timer to perform the loop automatically.
I’m receiving full banks like that (a full bank of n programs is received by doing loop requesting each individual program).
I have implemented a timer with a 150ms loop but you can set it to the most appropriate value according to your case. Not too slow because you loose time but not too fast because you will have bouncing errors and miss dumps. 100 – 150ms by program is quite OK.You need:
– one button to start the dumps and initialize the memory block that will hold the bank
– a timer that is performing the loop then when finished that will do something with your bank or just say “received”. A timer is simply a piece of code that is repeated at a certain time interval until it is stopped.
– RequestProgramDump method to send the program dump request
– MidiMessageReceived method to capture the each single dump and add it to the memory blockExtract of code for the button:
mbTempBank = MemoryBlock() bReceivingBank = true iCounter = 0 timer:setCallback (4, timerCallback) timer:startTimer(4, 150)
Extract of timer code:
-- Receive bank timer elseif timerId == 4 then if iCounter<500 then -- 500 is the number of programs to receive RequestProgramDump(iCounter) else timer:stopTimer(timerId) iCounter = 0 -- Check if not empty and if size is correct if mbTempBank~=nil then do_something...
RequestProgramDump method:
function RequestProgramDump(iProgram) -- No action if the panel is in bootstrap or program states if not isPanelReady() then return end -- Request Program Data dump (0-499) local iMSB = math.modf(iProgram/128) local iLSB = iProgram - iMSB * 128 msg = string.format("F0 42 30 00 01 4B 1C %.2x %.2x F7", iLSB, iMSB) -- msg = CtrlrMidiMessage({0xF0, 0x42, 0x30, 0x00, 0x01, 0x4B, 0x1C, 0xF7}) panel:sendMidiMessageNow(CtrlrMidiMessage(msg)) end
Extract of MidiMessageReceived method:
-- -- Called when a panel receives a midi message (does not need to match any modulator mask) -- @MidiMessage CtrlrMidiMessage object -- MidiMessageReceived = function(--[[ CtrlrMidiMessage --]] MidiMessage) -- console ("MIDI message received...") -- Find the Midi message type based on its size s = MidiMessage:getSize() if s == 15 then ... elseif s == 394 then if MidiMessage:getData():getByte(6) == 0x4C then -- console ("Program Dump recognized") if bReceivingBank then -- console ("Appending program "..tostring(iCounter)) mbTempBank:append(MidiMessage:getData()) iCounter = iCounter + 1 else ...
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.