The “old chestnut” throttling Midi transfer

Home Forums General Using Ctrlr The “old chestnut” throttling Midi transfer

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #117899
    shooking
    Blocked
      • Topics: 14
      • Replies: 60
      • Total: 74

      So I have read quite a few of the threads related to this. Lots of great ideas but so far I not found the definitive solution

      1 – when the Sysex fails it seems to block the Ctrlr from sending any more sysex successfully

      Is there a way to reset the “send” buffer?

      I can still receive and process Sysex from my K1r. And I can send to it from MidiOx so I suspect it is something I corrupt in Ctrlr?

      2 – I saw various threads about midi parameters in Ctrl

      I find under Edit->Preferences MIDI Mon input/output buffer sizes. That’s all.
      Where should I be looking for timeouts etc please?
      I seems to me the older threads no longer apply to more modern Ctrlr??

      3 – I have to split my sysex into a series of single transfers

      What is a way to wait say 125ms?
      The best I could find was Stackoflow

      
      -- delay in s
      function addDelay(n)
        local t = os.clock()
        while os.clock() - t <= n do
          -- nothing
        end
      end
      

      but this means I take 32 seconds to transfer 32 patches.

      Midi baud rate is 31250 +/- 10%. so what 3k per second.
      The largest midi I need to send is 8K .. so should take what 3 seconds if the buffers are not overflowed. I increase the midiMon buffer sizes … perhaps I should decrease them?

      K1 bulk sysex is

      HEADER
      [patch1]
      [patch2]..
      [patch32]
      EOS

      So I had to generate N headers, pull out patch_i, then compute and add checksum and add F7

      The good news is I have to do this anyhow to send in memory modifications – so this is ok.
      I will take stability over speed any day

      Hence I have to

      
      ...
            elseif size == gMULTIPLE_MULTI_SYSEX_TRAN then
      
                  debugConsole("received multiple multis")
                  console("received multiple multis")
      
                  worked = processMultiD(d, false)   
       
                  if worked == true and fromFile == true then
                      -- send to synth
                     	utils.warnWindow("\n\nINFO", "About to load a Multiple Multis into K1. WILL TAKE 32 SECONDS")
                      console("sending 1")
                      -- midi channel 00
                      -- how to find it?
                      local bias = d:getByte(7)
                      dumpMultiBlockIndividually(00, bias)
                  end
                  debugConsole("END received multiple multis")
                  console("END received multiple multis")
      ...
      
      function dumpMultiBlockIndividually(ch, bias)
          -- here we have read a multiBlock into our local buffers
          -- if you send the whole block to the K1r it chokes.
          -- so instead we create the sysex necessary to send as individuals.
          for i = 0, 31 do
              addDelay(1)
              
              local sysex = string.format("F0 40 %02x 20 00 03 00 %02x ",ch, i + bias)
              sysex=sysex..g_multiPatch:getRange(0, g_multiPatch:getSize() - 1):toHexString(1)
              
              local checksum = 0xA5
              for j=0, g_multiPatch:getSize()-1 do
                  checksum = checksum + g_multiPatch:getByte(j)
              end
      
      --        console("checksum"..checksum)
              checksum = BitAND(checksum, 127)
              console("checksum"..checksum)
              sysex = sysex..string.format(" %02x F7",checksum)
      --        console(""..sysex)
              panel:sendMidiMessageNow(CtrlrMidiMessage(sysex))
          end
      end
      

      But now at least I can read Sysex single/multi |X| bulk |X| {sysex, from file}.

      thanks in anticipation.

      #117901
      dnaldoog
      Participant
        • Topics: 4
        • Replies: 480
        • Total: 484
        • ★★

        Hi Shooking!

        Try

        os.execute(sleep(125))

        #117903
        shooking
        Blocked
          • Topics: 14
          • Replies: 60
          • Total: 74

          been trying to reply for ages – wordpress was playing silly bugger games!

          I call you out for Kudos @ 27 seconds in to my YT vid – https://www.youtube.com/watch?v=pO5xzGVCIoA&feature=youtu.be

          Your suggestion sure makes my panel behave like a 125 old British train (when they worked!)

          thanks again
          Steve

          #117907
          dnaldoog
          Participant
            • Topics: 4
            • Replies: 480
            • Total: 484
            • ★★

            Great! I watched the video – nice panel and thanks for the mention!

          Viewing 4 posts - 1 through 4 (of 4 total)
          • The forum ‘Using Ctrlr’ is closed to new topics and replies.
          There is currently 0 users and 118 guests online
          No users are currently active
          Forum Statistics
          Threads: 2,495, Posts: 17,374, Members: 77,605
          Most users ever online was 12 on January 22, 2019 3:47 pm
          Ctrlr