concatenate nibbles?

Home Forums General Programming concatenate nibbles?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #67850
    Possemo
    Participant
      • Topics: 14
      • Replies: 638
      • Total: 652
      • ★★★

      Hi, I am stuck on a problem reading MKS-70 Bulkdumps. The Roland MKS-70 seems to “obfuscate” the Patch Parameters in the way that it uses 96 Bytes to represent 48 Bytes. On the 96 Bytes only the lower Nibbles are used. Two pairs of lower Nibbles are representing a Byte. So the easiest way would be to concatenate the Nibbles. Is there an easy way to to this?
      Thanks for reading.

      #67883
      Possemo
      Participant
        • Topics: 14
        • Replies: 638
        • Total: 652
        • ★★★

        Tried somthing out that I found somewhere:

        SysexByte1 = 5
        SysexByte2 = 7
        
        upper = SysexByte1
        upper = 16*upper
        if upper > 127 then upper = upper - 128 end
        console (string.format ("upper=%d", upper))
        
        lower = SysexByte2
        
        combi = upper+lower
        console (string.format ("combi=%d", combi))

        could this do the trick? the upper 4 bits are always 0000 so we just have to convert the upper component. For this test i used no variables, assuming the sysex bytes were converted to decimal before.

        #67885
        atom
        Keymaster
          • Topics: 159
          • Replies: 2945
          • Total: 3104
          • ★★★★★

          You can do bit operations using the bitop module included in Ctrlr/lua
          http://bitop.luajit.org/

          #67938
          Possemo
          Participant
            • Topics: 14
            • Replies: 638
            • Total: 652
            • ★★★

            Thanks atom, looks nice. If my subroutine does not work I will try Bitop.

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