position of data in sysex received

Home Forums General Programming position of data in sysex received

Viewing 20 posts - 21 through 40 (of 59 total)
  • Author
    Posts
  • #117193
    EnzoF04
    Participant
      • Topics: 17
      • Replies: 102
      • Total: 119
      • ★★

      Hi dnaldoog, thanks for adding info! Much appreciated!

      I guess that you are right about the shifting. That does not work for now but….

      ---------------
      Modulator Value: 44
      Byte 03: (program number) 44
      adjusted message by Dnaldoog
      f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff af
      n 0
      n 227
      n 0
      n 0
      n 124
      n 0
      n 0
      n 207
      n 0
      n 0
      n 48
      n 15
      n 240
      n 120
      n 0
      n 120
      n 0
      n 135
      n 240
      n 352
      n 249
      n 120
      n 0
      n 0
      n 0
      n 0
      n 0
      n 135
      n 30
      n 0
      n 0
      n 0
      n 191
      n 0
      n 0
      n 0
      n 199
      ---------------

      console output for now. The patch I request is the all parameters set to max. Nice 37 parameters but incorrect values. Now I’m going to try to shift as you suggest!

      But when i convert the Hex data to Bin it is:
      11110000 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 10101111
      that makes sense; first byte 11 110000 is a six bit parameter with a max of 47 (110000 bin = 048 dec). First byte 11 110000 and second byte 11111111 is a 5 bit parameter with a max value of 31 (11111 bin = 031 dec).

      So; wouldn’t it be easier to work just in a binary version of the midimessage?

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

        Hi Enzo in the very first post, you posted a sysex message starting with 240 then 001. This was in decimal. That’s okay but usually when working with sysex hexidecimal is preferred and definitely not binary. So in Ctrlr Midi Monitor can you uncheck ‘RAW data in decimal‘, set all your 35/37 values to full on the synth? and then capture that midi message. It should start with F0 then 01 and end in F7 and be 37 bytes in length.

        I would like to see the message similar to that first message you posted but with all values set to max or maybe set the first 5 values to anything, but tell me what you set them to.

        Eg I set Osc coarse to 24,Glide rate to 9 etc.

        This way I can work back and find the necessary code to unravel the correct values from the 32 byte four bit nibbles, otherwise it’s going to be very difficult to know whether my code is correct or not.

        #117201
        EnzoF04
        Participant
          • Topics: 17
          • Replies: 102
          • Total: 119
          • ★★

          I’ve created a patch with these values
          24 - 16 - 14 - 03 - 07 - 11 - 15 - 07 - 31 - 07 - 15 - 07 - 63 - 31 - 03 - 07 - 11 - 15 - 07 - 31 - 07 - 31 - 07 - 03 - 07 - 11 - 15 - 00 - 01 - 00 - 01 - 00 - 01 - 00 - 01 - 00 - 01 - 00 - 00
          and the received sysex hex is
          18 f4 b9 fd fb ee 9d 1f 38 b7 7f df cd ed ab 0a
          which is in binary
          00011000 11110100 10111001 11111101 11111011 11101110 10011101 00011111 00111000 10110111 01111111 11011111 11001101 11101101 10101011 00001010

          So for the first parameter I have to take 00 011000 as data from byte 00 that makes 16 in dec over the last 6 bits.

          For the second parameter I have to take 0 0 011000 as part of data from byte 00 and 11111 100. I have to switch positions of the data parts as parameter 2 has 16 dec and that is 10000 in binary.

          • This reply was modified 4 years, 4 months ago by EnzoF04.
          #117203
          EnzoF04
          Participant
            • Topics: 17
            • Replies: 102
            • Total: 119
            • ★★

            I would like to see the message similar to that first message you posted but with all values set to max or maybe set the first 5 values to anything, but tell me what you set them to.

            [f0 01 05 2c 00 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0a f7]
            

            this is it.

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

              right shift ENVELOPE AMOUNT by 7
              left shift ENVELOPE AMOUNT by 1
              n 15
              right shift COARSE FREQUENCY by 0
              n 48
              right shift GLIDE RATE by 3
              n 15
              right shift FINE FREQUENCY by 6
              left shift FINE FREQUENCY by 2
              n 31

              I get this – it looks good!

              #117205
              EnzoF04
              Participant
                • Topics: 17
                • Replies: 102
                • Total: 119
                • ★★

                as you explain, I’m getting grip on this but the code is magical to me for now. This helps!

                right shift ENVELOPE AMOUNT by 7
                left shift ENVELOPE AMOUNT by 1
                n 15
                right shift COARSE FREQUENCY by 0
                n 48
                right shift GLIDE RATE by 3
                n 15
                right shift FINE FREQUENCY by 6
                left shift FINE FREQUENCY by 2
                n 31

                This helps!

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

                  Magical for me too – can’t believe it is working, but will do some more testing and post here soon. Fingers crossed!

                  #117207
                  EnzoF04
                  Participant
                    • Topics: 17
                    • Replies: 102
                    • Total: 119
                    • ★★

                    Magical for me too – can’t believe it is working, but will do some more testing and post here soon. Fingers crossed!

                    the shifting does not work at the moment. See attachment. But in theory this is the way to work it out.

                    Attachments:
                    You must be logged in to view attached files.
                    #117210
                    dnaldoog
                    Participant
                      • Topics: 4
                      • Replies: 480
                      • Total: 484
                      • ★★

                      It seems to be working for me. Can you post the function code you’ve got?
                      Here is the output FOR ALL 37 VALUES from the following function using the sysex string

                      • f0 01 05 2c 00 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0a f7

                      >> 37
                      f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff af
                      —————
                      right shift OSC COARSE FREQUENCY by 0
                      [1] n=48
                      —————
                      right shift LFO FREQ by 1
                      [2] n=15
                      —————
                      right shift LFO AMOUNT by 5
                      left shift LFO AMOUNT by 3
                      [3] n=31
                      —————
                      right shift OSC SAW by 2
                      [4] n=1
                      —————
                      right shift OSC PULSE by 4
                      [5] n=1
                      —————
                      right shift MIXER by 2
                      [6] n=15
                      —————
                      right shift FIL ENV RELEASE by 4
                      [7] n=15
                      —————
                      right shift FIL ENV DECAY by 4
                      [8] n=15
                      —————
                      right shift OSC TRI AMOUNT by 0
                      [9] n=63
                      —————
                      right shift FIL ENV AMOUNT by 4
                      [10] n=15
                      —————
                      right shift FIL ENV ATTACK by 0
                      [11] n=15
                      —————
                      right shift OSC TRI by 3
                      [12] n=1
                      —————
                      right shift VOICE VOLUME by 6
                      left shift VOICE VOLUME by 2
                      [13] n=15
                      —————
                      right shift OSC ENV ATTACK by 3
                      [14] n=15
                      —————
                      right shift UNISON by 7
                      [15] n=1
                      —————
                      right shift GLIDE RATE by 3
                      [16] n=15
                      —————
                      right shift LFO SHAPE by 0
                      [17] n=1
                      —————
                      right shift OSC ENV RELEASE by 0
                      [18] n=7
                      —————
                      right shift OSC FINE FREQUENCY by 6
                      left shift OSC FINE FREQUENCY by 2
                      [19] n=31
                      —————
                      right shift OSC ENV DECAY by 7
                      left shift OSC ENV DECAY by 3
                      [20] n=57
                      —————
                      right shift PULSE WIDTH by 3
                      left shift PULSE WIDTH by 5
                      [21] n=63
                      —————
                      right shift OSC ENV SUSTAIN by 3
                      [22] n=15
                      —————
                      right shift OSC ENV INVERT by 5
                      [23] n=1
                      —————
                      right shift FIL ENV INVERT by 6
                      [24] n=1
                      —————
                      right shift FIL FULL by 5
                      [25] n=1
                      —————
                      right shift FIL HALF by 4
                      [26] n=0
                      —————
                      right shift LFO FILTER by 3
                      [27] n=1
                      —————
                      right shift OSC ENV AMOUNT by 7
                      left shift OSC ENV AMOUNT by 1
                      [28] n=15
                      —————
                      right shift LFO PULSE by 2
                      [29] n=1
                      —————
                      right shift FIL ENV SUSTAIN by 0
                      [30] n=15
                      —————
                      right shift RESONANCE by 6
                      left shift RESONANCE by 2
                      [31] n=63
                      —————
                      right shift LFO OSC by 1
                      [32] n=1
                      —————
                      right shift FILTER CUTOFF by 7
                      left shift FILTER CUTOFF by 1
                      [33] n=127
                      —————
                      right shift AMP ENV RELEASE by 6
                      left shift AMP ENV RELEASE by 2
                      [34] n=15
                      —————
                      right shift AMP ENV SUSTAIN by 2
                      [35] n=15
                      —————
                      right shift AMP ENV DECAY by 6
                      left shift AMP ENV DECAY by 2
                      [36] n=15
                      —————
                      right shift AMP ENV ATTACK by 2
                      [37] n=15
                      —————

                      
                      function run(m)
                      local t={}
                      mbTemp32Byte=MemoryBlock()
                      mbTemp32Byte:append(m:getData():getRange(4, 32))
                      m16=MemoryBlock()
                      if mbTemp32Byte:getSize()==32 then
                      --assert(mbTemp32Byte:getSize()==32) -- development code can be deleted
                      for n=0,mbTemp32Byte:getSize()-1,2 do
                      local msb=bit.lshift(mbTemp32Byte:getByte(n+1),4)
                      local lsb=mbTemp32Byte:getByte(n)
                      table.insert(t,msb+lsb)
                      end
                      
                      m16:createFromTable(t)
                      console(String(m16:toHexString(1))) -- let's see what we got
                      panel:getLabel("debug"):setText(m16:toHexString(1))
                      
                      modulators={
                      ["OSC COARSE FREQUENCY"]={byte={0},position={0x3f},lShift={0},rShift={0}},--A
                      ["OSC FINE FREQUENCY"]={byte={0,1},position={0xC0,0x07},lShift={0,2},rShift={6,0}},--B
                      ["GLIDE RATE"]={byte={0x01},position={0x78},lShift={0},rShift={3}}, --C
                      ["OSC ENV AMOUNT"]={byte={0x01,0x02},position={0x80,0x07},lShift={0,1},rShift={7,0}}, --D
                      ["OSC ENV ATTACK"]={byte={0x02},position={0X78},lShift={0},rShift={3}}, --E
                      ["OSC ENV DECAY"]={byte={0x02,0x03},position={0X80,0X07},lShift={0,3},rShift={7,0}},--F
                      ["OSC ENV SUSTAIN"]={byte={0x03},position={0x78},lShift={0},rShift={3}},--G
                      ["OSC ENV RELEASE"]={byte={0x04},position={0x07},lShift={0},rShift={0}},--H
                      ["PULSE WIDTH"]={byte={0x04,0x05},position={0xF8,0x01},lShift={0,5},rShift={3,0}},--I
                      ["LFO FREQ"]={byte={0x05},position={0x1E},lShift={0},rShift={1}},--J
                      ["LFO AMOUNT"]={byte={0x05,0x06},position={0xE0,0x03},lShift={0,3},rShift={5,0}},--K
                      MIXER={byte={0x06},position={0X3C},lShift={0},rShift={2}},--L
                      ["FILTER CUTOFF"]={byte={0x06,0x07},position={0x80,0x3F},lShift={0,1},rShift={7,0}},--M
                      RESONANCE={byte={0x07,0x08},position={0xC0,0x0F},lShift={0,2},rShift={6,0}},--N
                      ["FIL ENV AMOUNT"]={byte={0x08},position={0xF0},lShift={0},rShift={4}},--O
                      ["FIL ENV ATTACK"]={byte={0x09},position={0x0F},lShift={0},rShift={0}},--P
                      ["FIL ENV DECAY"]={byte={0x09},position={0xF0},lShift={0},rShift={4}},--Q
                      ["FIL ENV SUSTAIN"]={byte={0x0A},position={0x0F},lShift={0},rShift={0}},--R
                      ["FIL ENV RELEASE"]={byte={0x0A},position={0xF0},lShift={0},rShift={4}},--S
                      ["OSC TRI AMOUNT"]={byte={0x0B},position={0x3F},lShift={0},rShift={0}},--T
                      ["VOICE VOLUME"]={byte={0x0B,0x0C},position={0xC0,0x03},lShift={0,2},rShift={6,0}},--U
                      ["AMP ENV ATTACK"]={byte={0x0C},position={0x3C},lShift={0},rShift={2}},--V
                      ["AMP ENV DECAY"]={byte={0x0C,0x0D},position={0xC0,0x03},lShift={0,2},rShift={6,0}},--W
                      ["AMP ENV SUSTAIN"]={byte={0x0D},position={0x3C},lShift={0},rShift={2}},--X
                      ["AMP ENV RELEASE"]={byte={0x0D,0x0E},position={0xC0,0x03},lShift={0,2},rShift={6,0}},--Y
                      ["OSC SAW"]={byte={0x0E},position={0x04},lShift={0},rShift={2}},--Z0
                      ["OSC TRI"]={byte={0x0E},position={0x08},lShift={0},rShift={3}},--Z1
                      ["OSC PULSE"]={byte={0x0E},position={0x10},lShift={0},rShift={4}},--Z2
                      ["OSC ENV INVERT"]={byte={0x0E},position={0x20},lShift={0},rShift={5}},--Z3
                      ["FIL ENV INVERT"]={byte={0x0E},position={0x40},lShift={0},rShift={6}},--Z4
                      UNISON={byte={0x0E},position={0x80},lShift={0},rShift={7}},--Z5
                      ["LFO SHAPE"]={byte={0x0F},position={0x01},lShift={0},rShift={0}},--Z6  (1=TRI)
                      ["LFO OSC"]={byte={0x0F},position={0x02},lShift={0},rShift={1}},--Z7 
                      ["LFO PULSE"]={byte={0x0F},position={0x04},lShift={0},rShift={2}},--Z8 
                      ["LFO FILTER"]={byte={0x0F},position={0x08},lShift={0},rShift={3}},--Z9 
                      ["FIL HALF"]={byte={0x0F},position={0x10},lShift={0},rShift={4}},--ZA
                      ["FIL FULL"]={byte={0x0F},position={0x20},lShift={0},rShift={5}},--ZB 
                      }
                      console('---------------')
                      counter=1
                      for k in pairs (modulators) do
                      n=0
                      for j,v in ipairs (modulators[k].byte) do
                      if j == 1 then
                      n=n+bit.rshift(bit.band(m16:getByte(v),modulators[k].position[j]),modulators[k].rShift[j])
                      console("right shift "..k.." by "..modulators[k].rShift[j])
                      else
                      console("left shift "..k.." by "..modulators[k].lShift[j])
                      n=n+bit.lshift(bit.band(m16:getByte(v),modulators[k].position[j]),modulators[k].lShift[j])
                      end
                      end
                      console(String(string.format("[%d] n=%d",counter,n)))
                      console('---------------')
                      counter=counter+1
                      --panel:getModulatorByName(k)getComponent():setValue(n,true)
                      end
                      end -- is 32 bytes coming in
                      end -- method
                      
                      #117212
                      dnaldoog
                      Participant
                        • Topics: 4
                        • Replies: 480
                        • Total: 484
                        • ★★

                        Hi Enzo,

                        Here is a panel containing the code.

                        In a program like MidiOx or Bome SendSX (I use this one) send the following code to the MIDI IN port of this panel.

                        f0 01 05 2c 00 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0a f7

                        Open up the console (first) and you should see the code I posted displayed.

                        Attachments:
                        You must be logged in to view attached files.
                        #117220
                        EnzoF04
                        Participant
                          • Topics: 17
                          • Replies: 102
                          • Total: 119
                          • ★★

                          Wow, you are such.a good helper! This is really cool! As I will dive into your panel, I’m getting it! Have time later on to work on it! I’ll let you know! This is great, Dnaldoog!

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

                            Great Enzo – a pleasure helping – let us know how it goes!

                            #117233
                            EnzoF04
                            Participant
                              • Topics: 17
                              • Replies: 102
                              • Total: 119
                              • ★★

                              I’m very pleased with the progress. Call back to the panel of data incoming from the synth and updating panel components working. A BIG STEP FORWARD! Really great! Getting my head around all kinds of stuff this way. See attached, big thanks for now, gtg, be back later!

                              • This reply was modified 4 years, 4 months ago by EnzoF04.
                              Attachments:
                              You must be logged in to view attached files.
                              #117236
                              EnzoF04
                              Participant
                                • Topics: 17
                                • Replies: 102
                                • Total: 119
                                • ★★

                                Do we need to change the lShift and rShift? The manual says received parameter data is right justified and LSB sent first.

                                Why I’m thinking of this is because i get strange values for some parameters.

                                EDIT: I don’t know. I think it works like it should. The strange thing is that when i change program, the coarse frequency is 14 and sounds like green, when I change the coarse frequency of the synth with my panel to 20 for example, the sound is blue-ish. When I change the coarse frequency back to 14 with the panel, the sound is NOT green again.
                                This is with some parameters on the panel.

                                I receive in sysex and I alter parameters with CC.

                                • This reply was modified 4 years, 4 months ago by EnzoF04.
                                • This reply was modified 4 years, 4 months ago by EnzoF04.
                                Attachments:
                                You must be logged in to view attached files.
                                #117240
                                dnaldoog
                                Participant
                                  • Topics: 4
                                  • Replies: 480
                                  • Total: 484
                                  • ★★

                                  Hi Enzo04,

                                  Might need to look a bit deeper into this!

                                  Which values are correct and which ones are wrong? Can you list them?

                                  Well done with the panel.

                                  One small thing that doesn’t really matter but may further your understanding of lua is that if a key to a table contains no strange characters (like a space for example) then they can be declared without the [” “].

                                  ["modOscCrsFreq"] ={byte={0x00},...--A
                                  ["modOscFinFreq"] ={byte={0x00,0x01},p...--B
                                  ["modGlideRate"] ={byte={0x01},posi... --C

                                  becomes…

                                  modOscCrsFreq={byte={0x00},...--A
                                  modOscFinFreq={byte={0x00,0x01},p...--B
                                  modGlideRate={byte={0x01},posi... --C

                                  #117241
                                  EnzoF04
                                  Participant
                                    • Topics: 17
                                    • Replies: 102
                                    • Total: 119
                                    • ★★

                                    One small thing that doesn’t really matter but may further your understanding of lua is that if a key to a table contains no strange characters (like a space for example) then they can be declared without the [” “].

                                    without I’ll get a compile error. Changed it back with “[ ]”.

                                    Things that are ‘strange’:
                                    Unison on/of sw doesn’t go with received data always
                                    Unison slider have to be switched twice ‘on’ to get affected in the synth
                                    Coarse frequency is correct received and displayed in the component but not coherent to the value changed value coming of the panel.
                                    VcfEnvAmnt is not as it should. When loading a program from synth, it is altered but when I change it in the panel it is off scale or something (wrong)/
                                    I commented the LfoAmount to ‘out’ because it generates a ‘Error message [string “run”]: 77: attemt to index a nil value.

                                    further testing is going on massively. 🙂 I’m glad at the moment!!

                                    #117242
                                    EnzoF04
                                    Participant
                                      • Topics: 17
                                      • Replies: 102
                                      • Total: 119
                                      • ★★

                                      perhaps there is a discrepancy between sysex and midi cc on the value basis??

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

                                        Page 11 of the Six-Trak manual has me confused about bit positioning,

                                        For example Glide rate 15 is 0ggg gxxx. 0111 1000 Maybe that means the data is left justified because of the Six-Trak processor architecture? But is then converted to right justified for MIDI?

                                        but if it’s all the other way around then all values should be wrong in my code. I don’t understand what If P=127,SEQ A and B, STACK A and B means.

                                        Massively confused.

                                        #117244
                                        EnzoF04
                                        Participant
                                          • Topics: 17
                                          • Replies: 102
                                          • Total: 119
                                          • ★★

                                          Page 11 of the Six-Trak manual has me confused about bit positioning,

                                          For example Glide rate 15 is 0ggg gxxx. 0111 1000 Maybe that means the data is left justified because of the Six-Trak processor architecture? But is then converted to right justified for MIDI?

                                          but if it’s all the other way around then all values should be wrong in my code. I don’t understand what If P=127,SEQ A and B, STACK A and B means.

                                          Massively confused.

                                          That’s why I’m confused too. A big part of all parameters in program is correct.
                                          If P = 127 (sent program 127) the sequencer and voice stacking mode.

                                          Almost all things work. So don’t be confused.
                                          I’m confused about the 6 bits for coarse value and the fact it only can hold 48 (00 to 47) values. While six bit data can hold up to 64 values. (see coarse value)

                                          attached is my Excel reference.

                                          Data transmitted is right justified as manual says, see attached.

                                          • This reply was modified 4 years, 4 months ago by EnzoF04.
                                          Attachments:
                                          You must be logged in to view attached files.
                                          #117253
                                          EnzoF04
                                          Participant
                                            • Topics: 17
                                            • Replies: 102
                                            • Total: 119
                                            • ★★

                                            Dnaldoog!

                                            I think i fixed the MSB & LSB switch; altering code in the ‘run” function:

                                            		for n=0,mbTemp32Byte:getSize()-1,2 do
                                            			local msb=bit.lshift(mbTemp32Byte:getByte(n+1),4)
                                            			local lsb=mbTemp32Byte:getByte(n)
                                            			table.insert(t,lsb+msb) --swapped msb+lsb to lsb+msb
                                            		end

                                            Parameters over more than one bit seem to match on panel as well on synth!

                                            The single bit parameters need to be converted from 1 for ‘on’ to 127 for ‘on’.

                                            • This reply was modified 4 years, 4 months ago by EnzoF04.
                                          Viewing 20 posts - 21 through 40 (of 59 total)
                                          • The forum ‘Programming’ is closed to new topics and replies.
                                          There is currently 0 users and 46 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