Combined MIDI controllers 14-bit

Home Forums General Programming Combined MIDI controllers 14-bit

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

      hi everyone,

      lazy initial question (passing thought), re: 14-bit MIDI CC protocol.

      eg: ‘combined controllers’ – you use two MIDI CC to send your higher resolution message,
      as MSB/LSB pair (‘coarse/fine’).

      you can have a look at Atom’s Synth Lite2 panel to see how this is implemented in Ctrlr,
      as a standard feature of Ctrlr. but i would like to code this in Lua. i’m a bit rusty,
      so i’m polling some advice before attacking it.

      essentially, the ‘low’/MSB CC will 0-31 ,and the ‘high’/LSB CC will be 32-63 (eg: n + 32 )

      i want to make a controller for MFB PolyLite, the ‘multi’/poly version of the SynthLite2,
      with a bit of flexibility, rather than relying on the built-in Ctrlr CC handling.

      thanks for any thought on this :tu:

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

        You can do that with BigInteger getBitRangeAsInt() method:

        To convert a Multi CC message as in:

        
        CC,ByteValue,MSB7bitValue,23,-1
        CC,ByteValue,LSB7bitValue,55,-1
        

        In Lua:

        
        --
        -- Called when a modulator value changes
        -- @mod   http://ctrlr.org/api/class_ctrlr_modulator.htmla
        -- @value    new numeric value of the modulator
        --
        myMultiCC = function(mod,value,source)
        local myChannel=panel:getProperty("panelMidiOutputChannelDevice")
        local add=0xb0+(myChannel-1)
              local bv=BigInteger(value) --break the value into 4bit nibbles
              local msb=bv:getBitRangeAsInt(7,7) -- position of msb
              local lsb=bv:getBitRangeAsInt(0,7) -- position of lsb
            m = CtrlrMidiMessage({add, 23, msb}) 
            l = CtrlrMidiMessage({add, 55, lsb}) 
            panel:sendMidiMessageNow(m)
            panel:sendMidiMessageNow(l)
        end--f
        

        Where 23 and 55 are the MSB/LSB Bank Select control numbers for adsr2Sustain uiSlider [ADSR Sustain] on that panel by Atom.

        … or alternatively you could split the value this way:

        
        msb=bit.rshift(value, 7)
        lsb=bit.band(value, 127)
        

        Regards,

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