Creating a slider with positive and negative values

Home Forums General Using Ctrlr Creating a slider with positive and negative values

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #529
    STRL
    Participant
      • Topics: 3
      • Replies: 6
      • Total: 9

      Hello!

      i’m trying to create a simple editor for the Kawai K3, but I’m running into problems with some of the parameters, most work fine, but I’m not sure how to properly set up certain things when more than one sysex string is required. The oscillator balance is a good example, in the sysex chart I have it is described like this:

      Waveform Balance (BAL): -15 -> +15 (Center @ 0)

      F0 40 00 10 00 01 04 08 0F F7
      F0 40 00 10 00 01 04 08 01 F7
      F0 40 00 10 00 01 04 00 00 F7 <- ( 0 Center)
      F0 40 00 10 00 01 04 00 01 F7 <- (+1)
      F0 40 00 10 00 01 04 00 0F F7 <- (+15)

      Entering F0 40 00 10 00 01 04 08 xx F7 as the sysex formula will let me control 1 to -15, but I’m not clear on how to get the slider to cover all the possible values, -15 to 15. I’ve tried adding these to multi-message list, but I’m not really sure what I’m doing.

      Any suggestions?

      Thanks!

      #3709
      Tronic
      Participant
        • Topics: 7
        • Replies: 45
        • Total: 52

        I had a look at the manual
        http://soundprogramming.net/manuals/Kawai_K3_Manual.pdf – page 49
        and it seems that you have set it correctly.
        I believe that the center parameter is 7, not 0

        #3710
        STRL
        Participant
          • Topics: 3
          • Replies: 6
          • Total: 9

          I’ve looked at that, and I can’t make any sense of it, I’ve been using the sysex chart attached to this post as it seems a little easier to understand. I’m just having a hard time getting the parameters with 5 lines of sysex working in Ctrlr, how do I translate these into something Ctrlr understands?

          #3711
          Tronic
          Participant
            • Topics: 7
            • Replies: 45
            • Total: 52

            need to split the value of the knob and MSB4bit LSB4bit
            setting the maximum value to 24, and the minimum value at -24
            with the formula
            F0 40 00 10 00 01 04 ms ls F7
            but unfortunately only works for the positive part
            because for the negative part should be added only the first bit, so that it is negative,
            but I do not know how to add only one bit to sysex byte.

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

              You can do it 3 ways

              1) use a FixedImageSlider and fill the list of values in a way that it will fit your formula perfectly
              2) use the expression fields to add/subtract/divide/multiply the modulator value to get the actual value you want
              3) use LUA to create/send those messages

              #3713
              STRL
              Participant
                • Topics: 3
                • Replies: 6
                • Total: 9

                Thanks for the responses, I’m still a little confused though. Say I used a fixed slider, how would I enter the sysex messages in the slider contents? I’ve tried adding this:

                -15= f0 40 00 10 00 01 04 08 0f f7
                -14= f0 40 00 10 00 01 04 08 0e f7
                -13= f0 40 00 10 00 01 04 08 0d f7
                -12= f0 40 00 10 00 01 04 08 0c f7
                -11= f0 40 00 10 00 01 04 08 0b f7
                -10= f0 40 00 10 00 01 04 08 0a f7
                (and so on..)

                But that doesn’t work, the slider won’t even move.

                I think part of the problem is the 8th character in the sysex code, this changes between negative and positive values, so -15 is F0 40 00 10 00 01 04 08 0F F7 whereas +15 is F0 40 00 10 00 01 04 00 0F F7.

                Sorry if I’m not explaining myself well, this is all pretty new to me.

                Thanks again

                Rick

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

                  No no, don’t enter SysEx in the Slider properties, leave the SysEx formula in the midi properties as it was (F0 40 00 10 00 01 04 ms ls F7) and assign correct numerical values like:
                  [code:34emyf36]
                  -15=1024
                  -14=1023
                  -13=1022
                  -12=1021
                  ...
                  [/code:34emyf36]

                  you just need to know witch numerical value split into LS/MS pair will make the pair you want for the position you want.

                  #3715
                  STRL
                  Participant
                    • Topics: 3
                    • Replies: 6
                    • Total: 9

                    Thank you! Entering the value as described did the trick.

                    I should have the K3 editor done in no time now, this was the main hurdle.

                    All the best

                    Rick

                    #3716
                    Tronic
                    Participant
                      • Topics: 7
                      • Replies: 45
                      • Total: 52

                      I could not resist to understand how we could do, and that is the function in LUA
                      I hope it will be useful

                      [code:1sjvtmtd]– @Tronic~2012

                      — Called when a modulator value changes

                      function K3m_Sysex_Formula(modulator,value)

                      — Get modulator Value
                      modulator = panel:getModulatorByName("Synth-2")
                      value = modulator:getModulatorValue()

                      — Binary Manipulation
                      if value < 0 then — Check if modulator value is negative
                      absvalue = value*-1 — Make value always positive
                      bin = CtrlrLuaBigInteger(absvalue) — Assign bin to class BigInteger
                      bin:setBit(7,true) — Set only one bit to 1
                      else
                      bin = CtrlrLuaBigInteger(value)
                      bin:setBit(7,false)
                      end

                      — Split Byte to two separate Byte
                      msb = bin:getBitRangeAsInt(4,4) — Get only 4bit and make it integer
                      lsb = bin:getBitRangeAsInt(0,4)

                      — Create & Send Sysex Message
                      sysex = CtrlrMidiMessage({0xF0,0x40,0x00,0x10,0x00,0x01,0x08,msb,lsb,0xF7})
                      panel:sendMidiMessageNow(sysex)

                      — Debug
                      byte = bin:toString(2,8)
                      console (string.format("Value=%d Byte=%s msb=%02x lbs=%02x",value, byte, msb, lsb))

                      end
                      [/code:1sjvtmtd]

                      #3717
                      mb47
                      Participant
                        • Topics: 7
                        • Replies: 8
                        • Total: 15

                        Hi all,

                        I need to send from a modulator SysEx formula like this one:
                        f0 40 09 10 00 06 15 02|MS LS f7
                        where with | I mean an OR operation on the bits.

                        It actually seems to accept it, as well as writing:
                        f0 40 09 10 00 06 15 02+MS LS f7

                        but both will only send
                        f0 40 09 10 00 06 15 02 LS f7
                        whatever the valus of MS is.

                        "atom":ud9lamkv wrote:
                        You can do it 3 ways

                        1) use a FixedImageSlider and fill the list of values in a way that it will fit your formula perfectly
                        2) use the expression fields to add/subtract/divide/multiply the modulator value to get the actual value you want
                        3) use LUA to create/send those messages[/quote:ud9lamkv]

                        Is method 3) the only possible in this case, or there also other ways?
                        I am not sure that method 1 could be used here.
                        Method number 2) sounds like the most straightforward, and wanted to try it out, but could not make it work.

                        Does anybody know how to do it?

                        Thanks!
                        Marco

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