re-usable modulators ?

Home Forums General Programming re-usable modulators ?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #82686
    human fly
    Participant
      • Topics: 124
      • Replies: 1070
      • Total: 1194
      • ★★★★

      i’m wondering if this is feasible:

      say i have a drum machine with 20 pads, each with
      the same set of 10 edit parameters, could i use just
      10 modulators, so that when, for example, pad#1 is
      selected, the modulators apply to pad#1, and then for
      pad#2, and so on?

      apparently yes, it need not be too complicated to set
      up the conditions. and so the sysex message would be
      built specifying pad number.

      however, as you would be changing back and forth between
      pads quite a lot, the panel would need to recall all parameter
      values each time you select a pad, and update the controls.
      so that suggests that values would have to be held in a table,
      and that table be updated every time a value changes.
      without all the parameters being sent out each time – just the
      most recent parameter.

      so that’s what i’ve started implementing. i’m getting the table
      rebuilding with a value change. it seems pretty instananeous.
      can you see any likely problems with this? or should i just make
      individual modulators for every single parameter?

      #82693
      human fly
      Participant
        • Topics: 124
        • Replies: 1070
        • Total: 1194
        • ★★★★

        some limited success with tables created on startup
        with:

        for i=1,120 do  --[ autocreate tables ]--
        _G["tbl_keyassgn"..i]={}
        end

        (yeah, there are really 120 groups of parameters)

        i make a variable to identify the table i want to write
        to: ‘keysel’

        and then go: (tbl_voiceParam is the list of modulators)

        for i,v in ipairs(tbl_voiceParam)do 
        local newval=(tbl_voiceParam[ i ]):getValue()
        table.insert(_G["tbl_keyassgn"..keysel],string.format("%d",newval))
        end

        so that was ok. but now i’ve done something and it’s adding too
        many items to the destination table, and i need to initialize it,
        but am having trouble initializing with:
        _G["tbl_keyassgn"..keysel]={}
        (because it’s global? back to the drawing board…)

        #82749
        goodweather
        Participant
          • Topics: 45
          • Replies: 550
          • Total: 595
          • ★★★

          Quite simple to do indeed but probably (as usual) several ways to achieve it 🙂
          – you can work with tables using key, values pairs
          – you can work with simple classical tables with index 0..n with 1 table by param
          – you can work with simple classical tables with index 0..n with 1 table by pad

          Once this is chosen, I would also define some kind of sysex file structure to load/save on disk then I would handle everything with memory blocks.
          As Lua is quite fast, switching pads and displaying values is immediate.

          #82750
          human fly
          Participant
            • Topics: 124
            • Replies: 1070
            • Total: 1194
            • ★★★★

            hi goodweather, thanks,
            i’ve moved it on quite a bit. got that to work reliably,
            – very nice –
            and i now have good understanding of where to
            initialize variables, local or global, so all of that is
            feeling much better/clearer.

            indeed, memblocks will be my ‘currency’ for memory. can
            retrieve and assign data easily like that. some very
            fiendish Yamaha implementation of minus values, though:
            7bit 2’s complement, with MSB/LSB.
            i will be back to talk about that(!) no doubt.

            i now have to build quite a complicated set of tables
            with reference data, for all factory kit setups, voice
            names, default MIDI note assignments, etc. etc.
            pretty silly to even take on the RX7! as it will almost
            require mirroring the internal data structure, by the
            look of things.

            but i can attest that it works, and so does initializing
            new tables on the fly with a generic prefix followed by
            identifier. i think i shall have a single temporary table
            from which i either copy into the respective tables (for
            recall), or to go straight to memblocks, and just get data
            back from those (although that will require a hex to decimal
            conversion). finding it interesting though.

            #82751
            goodweather
            Participant
              • Topics: 45
              • Replies: 550
              • Total: 595
              • ★★★

              Good! And I forgot to say that with Lua you can also have tables in tables if I’m not wrong…

              hex2dec and dec2hex is easy:

              --
              -- Returns HEX representation of a DECimal number
              --
              dec2hex = function(num)
              
                  local hexstr = '0123456789ABCDEF'
                  local s = ''
              
                  while num > 0 do
                      local mod = math.fmod(num, 16)
                      s = string.sub(hexstr, mod+1, mod+1) .. s
                      num = math.floor(num / 16)
                  end
                  if s == '' then s = '0' end
                  return s
              
              end
              
              --
              -- 	For the conversion of a DECimal number to anything else
              --	it is just needed to use the built-in Lua function tonumber(string, base)
              --
              --	print(tonumber("0100",2))
              --	4
              -- 	print(tonumber("3F",16))
              -- 	63
              #82752
              human fly
              Participant
                • Topics: 124
                • Replies: 1070
                • Total: 1194
                • ★★★★

                i have been using:

                --convert to hex
                --local tabl_hexcurrent = {}
                --for _,v in ipairs (tbl_voiceval) do 
                --table.insert(tabl_hexcurrent,string.format("%.2X",v))
                --end
                --dataconcat = table.concat(tabl_hexcurrent," ")
                --console(String("hex : "..dataconcat))
                -- ----------------------------------------------------
                --make a memory block from the string
                --local MemB = nil
                --MemB = MemoryBlock(dataconcat)

                so i should try your function.
                i am wondering about MSB/LSB – ?!? … because evidently
                simple string.format will not handle that (haven’t tried
                yet) – and then the ‘7bit 2’s complement’ for negative …
                basically, some value ranges are -600 to +600, and one is
                even -320 to +240.

                in fact, for this, i must dig out the RX7 and observe how
                many increments actually take place, and read the results
                out into midiox ( ie: cheat !! ) – i think FixedSlider uses
                a list of values, but have a feeling that the Object Properties
                would require too much compromise.
                note: the RX7 can send its most recent parameter by pressing
                the ‘Enter’ button. that will at least give me the sysex message.

                oh-ho-ho … and THEN, each ‘Key’ (a pad within a kit) has
                ‘offset parameters’ for 4 of the voice edit parameters…aaagh.
                so i do need to have a pause and meditate on it all a little bit
                at this point 😉

              Viewing 6 posts - 1 through 6 (of 6 total)
              • The forum ‘Programming’ is closed to new topics and replies.
              There is currently 0 users and 67 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