Another episode of help me translate the manual —

Home Forums General Programming Another episode of help me translate the manual —

Viewing 20 posts - 1 through 20 (of 22 total)
  • Author
    Posts
  • #6555
    Bomma72
    Participant
      • Topics: 20
      • Replies: 68
      • Total: 88

      or as I like to call it.  WTF Huh?!??

      So I am trying to program some stuff with the Kawai K3m but I am stuck on some of the parameters.

      Under III Data List on page 54.

      Specifically “Portanento Sw” and “Mono Sw”

      Not sure how I should interpret this, it looks like they are only one bite for each but they don’t have parameter numbers so I am not sure what parameter they are attached to or if this is something else entirely.

      Below is the manual.

      http://www.kawaius-tsd.com/OM/K_SYNTH/K3M.PDF

      Thanks for you help, you circa 80’s tech writing interpreter geniuses.

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

        It’s really simple, you need to look at column “Byte” and “Description” for ex: Portamento sw. has “Byte: accccccc” and “Description: a 0=ff, 1=on”, that means this byte holds 2 values the “a” is one bit and that bit says if portamento is on or off, the rest of the bits, make the value of “Portamento speed”. This byte is also always split into two actual MIDI bytes as described in 3-1 PARAMETER SEND (it’s similar to what DSI did in the Evolver MIDI Implementation, used full byte length of 8bits and did a split of two MIDI bytes each 4bits long, that’s the “ls” and “ms” tokens in Ctrlr)

        And yes a byte is not a MIDI byte, you need to remember everything in MIDI is 7bits long that’s what i call a MIDI byte, a real byte i computers is always 8bits long, that’s why you get only a range of 0-127 in one MIDI byte, if it was 8bits you’d get 0-255. That’s why KAWAI did their split, sending a computer byte (8bits total) in two MIDI bytes (4bits in evert 7bit byte)

        #6559
        Bomma72
        Participant
          • Topics: 20
          • Replies: 68
          • Total: 88

          “It’s really simple”  — Easy for you to say 🙂

          So if I understand you correctly I am basically combining the two variables (for lack of a better name) and then sending them as a Hexadecimal.

          Which begs the question how to do this.  Say I want to send Porameto Sw [on] or 1 and Portemto Time [25] or 11001.  This means I would be sending the byte 10011001 or translated int Hex 99?  The Sw field at the front and the Time field at the back, and the blank bits as 0 correct?

          So the next question would be how do I do this do I just create the text version of this (10011001) and then translate it into a Hex?  Is there a command to do that?  Also is there a command that will Translate the Decimal to a Binary?

           

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

            you need to learn the basic cause i see you really aren’t thinking “data”.

            the fact that something is hexadecimal or binary o decimal means it’s just how it’s represented for you on the screen, it’s the same data just presented in a different base (base 10 for decimal base 2 for binary base 16 for hexadecimal).

            There is a simple MIDI Calculator in Ctrlr, fiddle with it, type in some numbers observe the results, you’ll see that it’s all the same data.

            The situation here has 2 aspects (usually it’s 1)

            – there is more then one parameter sent with one SysEx message
            – all data is split into 2 bytes within one SysEx message

            you need to figure out a way to deal with those 2 things.

            #6591
            Bomma72
            Participant
              • Topics: 20
              • Replies: 68
              • Total: 88

              I’m sorry I thought this is what is exactly what I described in the previous post.  Tell me where I am going wrong.

              The Sysex for Protamento Time/SW is

              F0 40 00 10 00 01 03 00 xx F7

              The xx spot being where the 2 aspects that I am combining sent correct?

               

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

                For the format i can’t be sure. As for the “xx” i’m pretty sure is not what you want. Assumin we are talking Ctrlr sysex formula then:

                xx – means 7bit value

                and the synth uses 2 4bit long values so it should be:

                F0 40 00 10 00 01 03 ms ls F7

                BUT that’s just one value, that is either Time or Switch, you need to encode both values of the SWITCH and the TIME into this message (a button and a slider into one SysEx message)

                #6594
                Bomma72
                Participant
                  • Topics: 20
                  • Replies: 68
                  • Total: 88

                  OK now I see where I am misunderstanding.  So I can do this from the code behind right?  Meaning the [ms] will ether be 00 or 01 correct?

                  Something like this

                  hexstring = string.format(“F0 40 00 10 00 01 03 %.2x  %.2x  f7″, val1, val2)

                  After getting the Vals from the two components.

                  What do the ms, ls, xx mean respectively to they represent anything are they just substitute variables?  Is this specific to LUA or part of Ctrlr?

                  Is there anywhere where this information is available.  I hate to have to ask questions every time.  Something like this comes up.

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

                    The tokens are described in the Sysex Editor (the button “Edit” in the SysEx formula property, right click on a byte and you get a list o possibilities).

                    All the “xx” “ms” stuff is specific to Ctrlr, i had to simplify specifying where to put the value of the modulator or the midi channel in a sysex message. This works for about 75% of SysEx based devices. But the rest have more complicated implementations and you need to write some Lua to get this working.

                    #6596
                    Bomma72
                    Participant
                      • Topics: 20
                      • Replies: 68
                      • Total: 88

                      OK, thanks this will help a lot.  So essentially some of the “codes” correspond to subroutines that you wrote for control such as check-sum stuff?

                      So does my code idea about look like it might work or maybe what I describe below is better?

                      With the global variables can I have both controls write to different “globals” say K0 for the SW and K1 for the Time and then have both controls send the same command which would be something like.

                      “F0 40 00 10 00 01 03 K0 K1  f7″

                       

                      #6597
                      Hecticcc
                      Participant
                        • Topics: 25
                        • Replies: 160
                        • Total: 185
                        • ★★

                        I think this will do the trick for you. I have used some of this code for the binary stuff i encountered.

                        http://www.math.ntnu.no/~stacey/documents/Codea/Library/BinDecHex.lua

                        You will have to rip out some parts to make some custom functions of it, then you can use them for constructing your binary messages and convert to hex.

                        *edit*
                        link dissapeared on posting, put it as flat text instead.

                        #7162
                        Bomma72
                        Participant
                          • Topics: 20
                          • Replies: 68
                          • Total: 88

                          OK I am stuck with this.  I am not sure how to proceed.  Using lua I have been able to get both values from the slider and the button.  I then used the script above to translate the slider value into a 7 bit byte and the button into a one bit byte.  Finally I took this now 8 bit byte and converted it to decimal and sent it as a midi message.  This didn’t seem to work.  So at this point I am unsure what command in lua I should use to send it.
                           tried these
                          string.format(“F0 40 00 10 00 01 03 %.2x  %.2x  f7″, val1val2)  did this first with both values directly from the controls no translation.
                          string.format(“F0 40 00 10 00 01 03 00 %.2x  f7″, val1) with val1 being the method described above combining both after translation and then sending dec value.
                          and
                          string.format(“F0 40 00 10 00 01 03 ms ls f7″, val1,val2) this doesn’t send anything.
                          So my question is how do I transmit  this data I think I have it formatted correctly but don’t know how to send it.

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

                            You are mixing at least 3 things.

                            set this:

                            F0 40 00 10 00 01 03 ms ls f7
                            

                            as the SysEx formula property for your slider/button, and Ctrlr will deal with spltiing a 14bit value (that 0 – 16535) into ms and ls you don’t need Lua to do that.

                            #7168
                            Hecticcc
                            Participant
                              • Topics: 25
                              • Replies: 160
                              • Total: 185
                              • ★★

                              From what i can tell you still have to make a ms/ls split of the val1 value to get to the result you need.

                              You can do this using the bigInteger class, Atom posted an example here:http://ctrlr.org/forums/topic/converting-bytes/

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

                                If you “NEED” to do this in Lua for some other reason, use BigInteger or some other bit handling functions available in Lua, for example http://luaforge.net/projects/bit/ http://lua-users.org/wiki/BitUtils.

                                #7261
                                Bomma72
                                Participant
                                  • Topics: 20
                                  • Replies: 68
                                  • Total: 88

                                  So still no joy.  Not sure at this point where to go.  In the last post atom you said I should do this.

                                  “–SysEx formula property for your slider/button, and Ctrlr will deal with spltiing a 14bit value”

                                  Tried this but I think this doesn’t work because I have to set up the value in the correct format “accccccc” the “a” being the switch.  So I have to combine them in Lua first.

                                  So next I tried using the binary conversion code Hecticcc posted  to combine the data; for instance if the combine value of the switch on (1) and the time knob being 45 (0101101) the 8bit value should be “10101101”.  (is this right?)

                                  So now I tried to use the post about the converting bytes thread posted above by Hecticcc.  As I understand it I need to get two 7 byte values out of this 8 bit byte so I can send it as midi, however the CtrlrLuaBigInteger class doesn’t take strings, which is what my value is after doing the combining.

                                  So first question how do I convert the string value of “10101101” to be a binary value?

                                  OK so even though I don’t know how to do that yet,  I figured could at least check to see if it would work correctly if I found that command.  So I ran this code.

                                  bi = CtrlrLuaBigInteger(10101101)
                                  lsb = bi:getBitRangeAsInt(0,7)
                                  msb = bi:getBitRangeAsInt(7,7)

                                  panel:sendMidiMessageNow(CtrlrMidiMessage(string.format(“F0 40 00 10 00 01 03 %.2x %.2x F7”, msb, lsb)))

                                  No luck.  So I thought maybe my range isn’t right as the manual says value high-value (0000xxxx) and low value (0000xxxx).  Ok so maybe I have to do it like this.

                                  bi = CtrlrLuaBigInteger(10101101)
                                  lsb = bi:getBitRangeAsInt(0,4)
                                  msb = bi:getBitRangeAsInt(5,8)

                                  panel:sendMidiMessageNow(CtrlrMidiMessage(string.format(“F0 40 00 10 00 01 03 %.2x %.2x F7”, msb, lsb)))

                                  Nope, so I think I am close but I am not sure where I am going wrong.  What don’t I get?

                                  Sorry to keep pestering but there doesn’t seem to be a place to go to get this info, and I want to learn how to do this.

                                   

                                  #7262
                                  atom
                                  Keymaster
                                    • Topics: 159
                                    • Replies: 2945
                                    • Total: 3104
                                    • ★★★★★
                                    bi = CtrlrLuaBigInteger(10101101)
                                    

                                    This sets the initial value of the integer to ten million and a bit.

                                    You don’t use binary at all, the “01010101” notation is not used in programming languages. Use hexadecimal or decimal and stick to it (i recommend hexadecimal). Learn how to convert between hex/dec/bin and things will get easier.

                                    #7263
                                    Bomma72
                                    Participant
                                      • Topics: 20
                                      • Replies: 68
                                      • Total: 88

                                      But what is “accccccc” about in the manual  then?    I understand that that the data can be Hex, Bin, Dec.  The problem is how do I combine the two values? This is what I don’t get?

                                      So are you telling me that acccccccc doesn’t mean “a” is ether 1 or 0 and ccccccc is the binary form of the knob value?  As I understand it as you have said about I have to combind these two values and then send them right?

                                      I agree I need the basics but where can I go to get the basics?

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

                                          Also this explains the 14bit split in RPN messages, but it applied in general: http://www.blitter.com/~russtopia/MIDI/~jglatt/tech/midispec/rpn.htm

                                          #7267
                                          Bomma72
                                          Participant
                                            • Topics: 20
                                            • Replies: 68
                                            • Total: 88

                                            So if I take the two controls? and convert there values to Hex I still don’t get how to send them?

                                            You said above that the synth uses

                                            F0 40 00 10 00 01 03 ms ls F7

                                            Time or Switch, you need to encode both values of the SWITCH and the TIME into this message (a button and a slider into one SysEx message)

                                            I thought the accccccc meant that the first bit was the switch and the next 7 were the time value?

                                          Viewing 20 posts - 1 through 20 (of 22 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