multiple if syntax question

Home Forums General Programming multiple if syntax question

Viewing 20 posts - 21 through 40 (of 40 total)
  • Author
    Posts
  • #71290
    dasfaker
    Keymaster
      • Topics: 80
      • Replies: 793
      • Total: 873
      • ★★★

      The checksum of the sysex message for the first value posted by human fly was 0x70 (112), so as you increase the xx value (sum variable), the checksum will decrease.

      #71291
      human fly
      Participant
        • Topics: 124
        • Replies: 1070
        • Total: 1194
        • ★★★★

        exponent = to the power of, yeah?
        but how can 2 to the power of 0 be 1?

        i’m gonna try both of these methods with the buttons
        and see if i can it working.

        • This reply was modified 7 years, 2 months ago by human fly. Reason: offtopic
        #71292
        human fly
        Participant
          • Topics: 124
          • Replies: 1070
          • Total: 1194
          • ★★★★

          The checksum of the sysex message for the first value posted by human fly was 0x70 (112), so as you increase the xx value (sum variable), the checksum will decrease.

          oh of course, – there i was, lost in hexa-land 🙂

          #71293
          human fly
          Participant
            • Topics: 124
            • Replies: 1070
            • Total: 1194
            • ★★★★

            before i do, what does elseif do (for my long version)?

            with dasfaker’s, the checksum is worked out on not just
            the value byte/s but also the address bytes. so that’s
            0x04, 0x00, 0x0c, and the value (0x00 – 0x0F)

            attaching a nice little checksum calculator to this post,
            i can’t find the site again right now. no install, just
            unzip and run.

            panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x10, 0x16, 0x12, 0x04, 0x00, 0x0c, sum, 112 – sum, 0xf7}))

            so ‘sum’ is the parameter value?
            why is 112 in decimal? and why is it checksum minus sum?
            that byte only needs to be the checksum. or is that how
            ‘checksum’ is expressed?

            and then it goes ‘end’, yeah?

            Attachments:
            You must be logged in to view attached files.
            #71295
            human fly
            Participant
              • Topics: 124
              • Replies: 1070
              • Total: 1194
              • ★★★★

              very nice, btw.

              #71296
              human fly
              Participant
                • Topics: 124
                • Replies: 1070
                • Total: 1194
                • ★★★★

                got it: ‘elseif’ is between the possibles.
                (in the long version)
                and the whole thing ends with ‘end’.

                with dasfaker’s elegant method, i’m taking it that
                ‘112-sum’ means ‘checksum’, then? so that happens
                with decimal rather than hexadecimal?

                time for a cup of tea.

                • This reply was modified 7 years, 2 months ago by human fly.
                #71298
                goodweather
                Participant
                  • Topics: 45
                  • Replies: 550
                  • Total: 595
                  • ★★★

                  Just got my cup of tea as well…
                  You can put decimal or hexa in the CtrlMidiMessage table. If you write a number as 123 it will be taken as decimal while if you write 0xF5 it will be taken as hexa.
                  112-sum is indeed your checksum
                  So, with one calculation of sum you can fill in any message and send it

                  #71299
                  dasfaker
                  Keymaster
                    • Topics: 80
                    • Replies: 793
                    • Total: 873
                    • ★★★

                    I think you need to read the Roland manual.

                    Roland checksum:
                    Calculating the checksum follows a simple formula which is easily learned and applied. Following this formula will guarantee correct checksums:

                    1. Convert the hex values to decimal.
                    2. Add the values together, but if the answer to any sum exceeds 127 then subtract 128.
                    3. Subtract the final answer from 128.
                    4. Convert the resulting value back to hex and use as the checksum.

                    Example:
                    f0 41 10 16 12 04 00 0c 00 chk f7
                    Checksum is calculated only on bold values on your synth.

                    1. Convert to decimal: 04 00 12 00
                    2. Add the values: 04 + 00 + 12 + 00 = 16
                    3. Subtract 16 from 128: 128 – 16 = 112
                    4. Convert to hex: 112 –> 70

                    Another way:
                    1. Convert to decimal: 04 00 12 00
                    2. Add the values: 04 + 00 + 12 + 00 = 16
                    3. Divide by 128: 16 / 128 = 0 with remainder 16
                    4. Subtract remainder from 128: 128 – 16 = 112
                    5. Convert to hex: 112 –> 70

                    #71300
                    human fly
                    Participant
                      • Topics: 124
                      • Replies: 1070
                      • Total: 1194
                      • ★★★★

                      that is very cool, what you’ve just shown me.
                      i’ve been racking my head over this for a long time:
                      how to get 4 completely separate parameters out of one
                      parameter value range.
                      you can’t do anything like this on the Novation Remote.
                      and you can’t do 14bitCC either, with Coarse/Fine, like
                      with the SynthLiteII panel. in fact there are serious
                      limitations as to what is possible with that box. they
                      need to re-do the firmware and the editor to accept
                      different data formats – because it’s great to be able
                      to program it for hardware. mostly, people just map it
                      up to a plugin, and do it that way, so you’d map up to
                      a Ctrlr panel instead.

                      and yet, the D-11O front panel has always been able to
                      do it, and the PG-10 controller can control everything
                      on all the parts at different addresses that do not
                      sum start+offsets in any immediate or user-friendly
                      way (see D-110 manual, p118/119).

                      #71301
                      human fly
                      Participant
                        • Topics: 124
                        • Replies: 1070
                        • Total: 1194
                        • ★★★★

                        yeah, i have read the manual, and years ago, i did
                        do it by hand, but i’m lazy and now i understand it
                        i’m allowed to cheat 🙂 – plus, if you’re rattling
                        through 400+ parameters, it’s nice to have a little
                        aid, same as midiox helps check through really
                        quickly, if, for example, you’ve just loaded it all
                        into a RemoteSL, and it runs to 17 pages, which the
                        D110 does, with Multi set-up, and a couple of octaves
                        of rhythm notes. you just twiddle the knobs, and make
                        a quick visual check that the checksum is decrementing
                        as the value increments – you can whizz through it,
                        and find mistakes and omissions with a quick visual
                        reference – is it moving or not. if you’ve done your
                        work and setting up thoroughly, it should be good.
                        and you only have to calculate the first checksum if
                        all your parameters are in consecutive numerical
                        order with no gaps – i make a notepad file, figure
                        out the first good message after listing all the
                        parameter names, and step through typing it all in
                        series. the RemoteSL actually calculates the checksum
                        for you – you just have to set the datatype to ‘roland’
                        for each control, press write twice, and it starts
                        doing it. it’s all hard manual labour. the editor
                        won’t do it, you have to set it on the hardware.
                        another shortcoming. Novation told me it was only
                        ever meant to be a beta software. funny they made
                        a markII of the device though, before they did a v1
                        of the editor 🙂 just proves nobody uses it much.

                        #71303
                        human fly
                        Participant
                          • Topics: 124
                          • Replies: 1070
                          • Total: 1194
                          • ★★★★

                          how about persuading them to update it?

                          • This reply was modified 7 years, 2 months ago by human fly.
                          #71304
                          dasfaker
                          Keymaster
                            • Topics: 80
                            • Replies: 793
                            • Total: 873
                            • ★★★

                            Thanks for the offer. I know what you are talking about, I own a Remote SL too, and made a template for the Snow years ago (I used the template editor), and another one with the BCR2000 , but now I’m not interested in controlling the synths this way.

                            #71305
                            human fly
                            Participant
                              • Topics: 124
                              • Replies: 1070
                              • Total: 1194
                              • ★★★★

                              • This reply was modified 7 years, 2 months ago by human fly. Reason: typo
                              • This reply was modified 7 years, 2 months ago by human fly.
                              • This reply was modified 7 years, 2 months ago by human fly.
                              • This reply was modified 7 years, 2 months ago by human fly. Reason: offtopic
                              #71307
                              dasfaker
                              Keymaster
                                • Topics: 80
                                • Replies: 793
                                • Total: 873
                                • ★★★

                                For me it worked fine, but it was limited. Once I knew about Ctrlr I don’t need anymore.
                                Thanks Mr Kubiak!!!

                                #71308
                                goodweather
                                Participant
                                  • Topics: 45
                                  • Replies: 550
                                  • Total: 595
                                  • ★★★

                                  For me it worked fine, but it was limited. Once I knew about Ctrlr I don’t need anymore.
                                  Thanks Mr Kubiak!!!

                                  Yes indeed. Thanks Roman!

                                  I have also a 25SL MkII but I would never want to control all the params of a synth like that. One button, one function and OK, max 2 pages so you can memorize…
                                  Thus, when you have much more params, best is PC and Ctrlr 🙂

                                  #71310
                                  human fly
                                  Participant
                                    • Topics: 124
                                    • Replies: 1070
                                    • Total: 1194
                                    • ★★★★

                                    well i was foolish enough to have a go at it 🙂
                                    i wanted something to use without a PC.
                                    here’s the Remote D-110 as a bulk file, next time
                                    you fire up your Remote:

                                    https://app.box.com/s/yo46rr2q3e67tnxhtkel3c3480uj7hot

                                    the template series link up via the Pads, set as Template
                                    links. no template series is more than 3 deep, most are
                                    just 2, so they toggle A/B
                                    (has 2 or 3 mistakes i just came across but otherwise working;
                                    ok, so you don’t have a D-110..)

                                    here’s JV-1080(pattch edit, no multi setup):
                                    https://app.box.com/s/up0kxs6srr7a1hhvntai9y4w12twspq7

                                    Kawai K1 (3 pages, preset edit)
                                    https://app.box.com/s/0lsiqrds905a9y563ddusuq6d2jtfdnq

                                    i think the zeroSL mk2 is the only model without the side
                                    navigation buttons. i have mk1 with the dual lcds. i’m
                                    considering getting another one, as a 2 or 3 oct keyboard.

                                    • This reply was modified 7 years, 2 months ago by human fly.
                                    • This reply was modified 7 years, 2 months ago by human fly. Reason: typo
                                    #71342
                                    SWB
                                    Participant
                                      • Topics: 35
                                      • Replies: 157
                                      • Total: 192
                                      • ★★

                                      This code formatting in a message works for me now also. Thanks! Will make a note of this, tend to forget all this useful stuff ;-).

                                      #71348
                                      human fly
                                      Participant
                                        • Topics: 124
                                        • Replies: 1070
                                        • Total: 1194
                                        • ★★★★

                                        here’s a small panel with the long lua, not sending anything yet
                                        >see attached

                                        and here’s the lua, probably has errors:
                                        >> see text attached

                                        i’m off to have to go with dasfaker’s lua. just want to see if
                                        i can get this working too. probably worth checking through the
                                        panel+modulator properties, in case it’s inherited errors from
                                        the original panel, etc.

                                        i’m confused about how the method is added. i add it in resources,
                                        then call it up at ‘when value changes’ – but then i get an empty
                                        lua if i look at it with ‘edit selected method’.
                                        so i copied all of my text over all of what is in the dialog.
                                        it still highlights red;
                                        so then i run save and compile, and get back ‘OK’.
                                        it still doesn’t send MIDI (Panel Mode enabled)

                                        back in a bit with the next file.

                                        Attachments:
                                        You must be logged in to view attached files.
                                        #71370
                                        human fly
                                        Participant
                                          • Topics: 124
                                          • Replies: 1070
                                          • Total: 1194
                                          • ★★★★

                                          morning ! ok, so i’m messing around trying to get the
                                          new Method running. taking this now over to this fresh topic here:

                                          How to add new lua?

                                          #71409
                                          human fly
                                          Participant
                                            • Topics: 124
                                            • Replies: 1070
                                            • Total: 1194
                                            • ★★★★

                                            bump – follow-on/update on this.

                                            reporting back: i’m feeling unreasonably chuffed at getting
                                            a first method running (‘my little lua1’…)

                                            the ‘long’ method works perfectly. i couldn’t get it to compile
                                            because the last end wasn’t put it correctly. i think it was as
                                            simple as deleting the extra line.(?forgot!..)

                                            the second optimized method works but does a weird-thing on panel
                                            load – it sends out 4 sysex messages – it seems the ‘end’ on each
                                            condition is triggering the sum, or maybe it is the declaring of
                                            modulators. i tried ‘ren’-ing the declares…but at that point
                                            something was confusing me because another open panel, possibly
                                            sharing same parameter ID/index# was also sending out its own
                                            sysex for a different parameter. (Ctrlr bug, surely? should only
                                            be the panel in view that should be active -?) – i think there
                                            was a different problem then, i’ll have to try again. i also
                                            made a hybrid version with getValue and then the sum process.
                                            anyway: attached is a version that compiles and works, but sends
                                            the 4 messages on load.

                                            Partials Lua2 H.zip

                                            Attachments:
                                            You must be logged in to view attached files.
                                          Viewing 20 posts - 21 through 40 (of 40 total)
                                          • The forum ‘Programming’ is closed to new topics and replies.
                                          There is currently 0 users and 114 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