If…then, elseif…then ?

Home Forums General Programming If…then, elseif…then ?

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #70553
    JDXA
    Participant
      • Topics: 10
      • Replies: 45
      • Total: 55

      Hello the World,

      Well I have a syntax problem :

      I have to send 3 sysex messages with one uiCombo or uiListBox element.

      To choose my digital waveforms (there are 469) I would like to use uiCombo or uiList Box…
      If I’m right the more you put values or objects in the List Box or Combo Contents the more the value is augmented… so for 469 names inside Combo Contents I have 469 values.

      I’ve done a LUA routine to say.. on value ==0 then …
      well, here’s my example :

      if value == 0 then

      msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x00, 0x06, 0x3F, 0xF7})
      elseif value == 0 then
      msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x01, 0x00, 0x44, 0xF7})
      elseif value == 0 then
      msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x35, 0x00, 0x00, 0x00,0x00, 0x10, 0xF7})
      end
      panel:sendMidiMessageNow(msg)

      if value == 1 then
      msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x00, 0x05, 0x40, 0xF7})
      elseif value == 1 then
      msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x01, 0x00, 0x44, 0xF7})
      elseif value == 1 then
      msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x35, 0x00, 0x00, 0x00,0x00, 0x10, 0xF7})
      end
      panel:sendMidiMessageNow(msg)

      Is it correct ?

      because when I choose an object into uiCombo, only the first is OK…

      I have made also uiBotton with Direct Sysex values and it’s working very well !

      So, I think my syntax is not correct !

      If you have a solution, I’ll be very happy,

      Thanks a lot,

      Xavier-Joseph from REunion Island,

      • This topic was modified 7 years, 4 months ago by JDXA.
      • This topic was modified 7 years, 4 months ago by JDXA.
      #70566
      JDXA
      Participant
        • Topics: 10
        • Replies: 45
        • Total: 55

        Hi the World,

        Night gives advice :

        I have find a solution, perhaps not the better because it’s very laborious but it’s working very well !

        I’ve seen that the problem was CTRLR sent only one order so only the first order was listened.

        So I decided to say to CTRLR to send many orders and close them after…

        Here’s an example :

        if value==1 then
        msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x00, 0x05, 0x40, 0xF7})
        end
        panel:sendMidiMessageNow(msg)

        if value==1 then
        msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x01, 0x00, 0x44, 0xF7})
        end
        panel:sendMidiMessageNow(msg)
        if value==1 then
        msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x35, 0x00, 0x00, 0x00,0x00, 0x10, 0xF7})
        end
        panel:sendMidiMessageNow(msg)

        the messages are not linked in the same packet but it’s working fine !

        Now, I have to enter 469 sysex adresses…

        Have a nice day,

        See you later,

        Xavier-Joseph from Reunion Island,

        • This reply was modified 7 years, 4 months ago by JDXA.
        #70574
        JDXA
        Participant
          • Topics: 10
          • Replies: 45
          • Total: 55

          Hi,

          Is there a solution to enter Sysex formula in LUA othen than 0xF0, 0X10….

          It would nice to copy and paste the Sysex gave by CTRLR or MidiOx !

          I have 469 Digital waveforms, 4 parts with each 3 partials (with Sysex own adresses), 3 adresses per partials… well, [(469*3)*4]*3 = 16884 adresses to enter manually !!!!
          WOW !

          • This reply was modified 7 years, 4 months ago by JDXA.
          #70577
          Possemo
          Participant
            • Topics: 14
            • Replies: 638
            • Total: 652
            • ★★★

            You would do that like this:

            if value==1 then

            msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x00, 0x05, 0x40, 0xF7})
            panel:sendMidiMessageNow(msg)

            msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x01, 0x00, 0x44, 0xF7})
            panel:sendMidiMessageNow(msg)

            msg = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x0F, 0x12, 0x1A, 0x01, 0x20, 0x35, 0x00, 0x00, 0x00,0x00, 0x10, 0xF7})
            panel:sendMidiMessageNow(msg)

            end

            Everything that matches the case where value is 1 must be within the same if statement. Elseif means: if the values IS NOT the value checked by the first IF statement then do something ELSE.

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

              Yes you can enter them like this:

              
              panel:sendMidiMessageNow(CtrlrMidiMessage("F0 41 10 00 00 00 0F 12 1A 01 20 00 05 40 F7"))

              In sysex there usually is a long prefix that is always the same. Here it looks like the first 11 values. So in fact only 3 values are changing. You could do that like this:

              v1="00"
              v2="05"
              v3="40"
              panel:sendMidiMessageNow(CtrlrMidiMessage("F0 41 10 00 00 00 0F 12 1A 01 20 "..v1.." "..v2.." "..v3 " F7"))

              Maybe there could be done a calculation to get the 3 values. For this I would have to study the sysex implementation chart some more.

              • This reply was modified 7 years, 4 months ago by Possemo.
              • This reply was modified 7 years, 4 months ago by Possemo.
              • This reply was modified 7 years, 4 months ago by Possemo.
              #70582
              Possemo
              Participant
                • Topics: 14
                • Replies: 638
                • Total: 652
                • ★★★

                I just found out that you don’t have to put spaces between the variables in the message, so this one is much easier:

                
                function myNewMethod()
                v1="00"
                v2="05"
                v3="40"
                panel:sendMidiMessageNow(CtrlrMidiMessage("F0 41 10 00 00 00 0F 12 1A 01 20"..v1..v2..v3.."F7"))
                end
                #70584
                Possemo
                Participant
                  • Topics: 14
                  • Replies: 638
                  • Total: 652
                  • ★★★

                  I dived a bit deeper into the JX-XA sysex implementation. Oh man this is damn complicated. I think it will be very hard to achieve as a “first Ctrlr project”.

                  This is what if think I found out:

                  Prefix: F0 41 10 00 00 00 0F 12 – this will always be the same

                  Address (selecting a parameter):
                  1A 00 00 00 | Temporary Tone (Digital Part 1)
                  20 00 | SuperNATURAL Synth Tone Partial (1)
                  00 35 | Wave Number

                  Result, selecting Digital Wave Number on Temporary Tone Digital Part 1 on SuperNatural Synth Tone Partial 1: 1A 00 20 35

                  Value for the parameter: a 14-bit value (16384 values), divided into four 4-bit nibbles. That does not make much sense to me. Four 4-bit nibbles are making a 16-bit value (65536 values). Anyway… I think selecting wave number 1 should look like this:

                  F0 41 10 00 00 00 0F 12 1A 00 20 35 00 00 00 01 checksum F7

                  You need to calculate a checksum. You will have to use a modulo function. It is not very hard as the math library of Lua will more or less do it for you. But then I am not that good in maths. Maybe someone else? Here the algorithm explained by Roland:
                  calculate the checksum.
                  18H + 00H + 02H + 00H + 02H = 24 + 0 + 2 + 0 + 2 = 28 (sum)
                  28 (sum) / 128 = 0 (quotient) … 28 (remainder)
                  checksum = 128 – 28 (remainder) = 100 = 64H

                  • This reply was modified 7 years, 4 months ago by Possemo.
                  • This reply was modified 7 years, 4 months ago by Possemo.
                  • This reply was modified 7 years, 4 months ago by Possemo.
                  • This reply was modified 7 years, 4 months ago by Possemo.
                  • This reply was modified 7 years, 4 months ago by Possemo.
                  #70591
                  goodweather
                  Participant
                    • Topics: 45
                    • Replies: 550
                    • Total: 595
                    • ★★★

                    Thx Poss!
                    I was chatting with Xavier-Joseph about this topic… Now that you clarified some stuff, I can take the relay for the checksum (however I’m sick today).
                    I come back to you as soon as possible…

                    #70593
                    JDXA
                    Participant
                      • Topics: 10
                      • Replies: 45
                      • Total: 55

                      Hi Possemo,
                      Hi Goodweather,

                      Well, JD-XA is very complicated…

                      I’m going to try to call Waveform adress by number, tomorrow in the morning.
                      But, I’ve notice that you can only use digital waveforms when you select digital parts and you activate the “variation button”.
                      I think it’s for that there’s 3 sysex adresses.

                      I have begun to enter manually all the adresses…
                      This day, I’ve typed 410 adresses(x3), that means tomorrow I finish the D1-1 section, after I have the D1-2 and the D1-3 and after the D2-1, D2-2 and D2-3 and finally the D3-1, D3-2 and D3-3, D4-1, D4-2,D4-3 !

                      But, tommorrow I’ll try to call with the number…

                      Thanks for your help…

                      Have a nice night plenty of sweet dreams,

                      Xavier-Joseph from Reunion island,

                      • This reply was modified 7 years, 4 months ago by JDXA.
                      • This reply was modified 7 years, 4 months ago by JDXA.
                      • This reply was modified 7 years, 4 months ago by JDXA.
                      #70599
                      goodweather
                      Participant
                        • Topics: 45
                        • Replies: 550
                        • Total: 595
                        • ★★★

                        Please wait doing manual work while we try supporting you with code…most things can be automated…

                        Edit: I have now automated part / partial / wave and I’m busy with the checksum.
                        Will continue tomorrow…

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

                          Bonjour Xavier-Joseph!
                          Please have a look and try this panel…

                          • You can choose the program
                          • You can choose the partial
                          • You can choose the wave (I just put a limited list)
                          • When changing the wave, you get an adapted display + the sysex to send

                          In the code, you should uncomment the actual send to the synth (I don’t have a JDXA but may buy one when the DM12 will be out – I guess many JDXA will be available for cheap money…).

                          Before doing that, take a copy of the sysex and send it to the JDXA to see if the wave form is adapting.
                          If issues, just let me know.

                          The code in the panel is just an appetizer but gives you a good idea of what you should do. Many params in the JDXA and lot’s of programming but could be really nice.

                          Btw, I saw there was an editor provided by Roland. Isn’t it good enough?

                          Have fun 🙂

                          Attachments:
                          You must be logged in to view attached files.
                          #70642
                          JDXA
                          Participant
                            • Topics: 10
                            • Replies: 45
                            • Total: 55

                            Hi Goodweather,

                            Wow, thanks, I’m going to test !

                            Roland don’t do an editor but a librarian (just to organize parts and download from Roland site).

                            #70658
                            JDXA
                            Participant
                              • Topics: 10
                              • Replies: 45
                              • Total: 55

                              Hi Goodweather

                              Well, it’s not working !

                              I try to examinate your routine and there’s some dark points… for me ! (better dark points than one Dark Vador !!!)

                              I cannot understand all your routine.

                              I have made some adresses manually (it’s very very looooooooong!) and take some place.

                              I’ve notice thaht CTRLR run more slowly and take about 1 minutes to save the job !

                              Is it normal or is it an option to tweak ?

                              I learning your code and try to understand where’s the problem !

                              See you soon,

                              It’s raining a lot… Chameleons are happy !

                              Xavier-Joseph from my banana garden…

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

                                OK 🙁
                                Let’s first try to check if the sysex I’m building is working…
                                Do you have a PC or Mac? If PC then download Midi-OX. It allows you to exchange data with your synth. Do you know Midi-OX or do you need some guidance?

                                About my panel (and independently of your synth): does it work? Select a program then select a partial then change wave (you must change wave to get the sysex – this can be improved later).
                                Please make some choice and post the string or a screenshot.

                                Instead of Midi-OX, you can also open the Midi Monitor within Ctrlr. Activate Input and Output monitoring.
                                At the bottom of the console window, you can type
                                panel:sendMidiMessageNow(CtrlrMidiMessage(“your_sysex_string”))
                                REPLACE your_sysex_string by what you get in the panel I gave you
                                then press enter

                                What do you see in the Midi monitor?
                                What do you see on the JDXA?
                                You said you succeeded to modify something using a button. Can you do it again and check the Midi Monitor window?

                                We’ll find the issue; just a question of patience…
                                And, after the rain comes the sun 🙂

                                #70682
                                JDXA
                                Participant
                                  • Topics: 10
                                  • Replies: 45
                                  • Total: 55

                                  Hi Goodweather,

                                  I’m going to do this today.

                                  Yes, I know and use MidiOx and also Midi Monitor from CTRLR (an others)… with these tools I verify my work on doing the JD-XA editor.

                                  I filter all adresses…

                                  For the Digital Waveforms, JD-XA sends 3 sysex adresses, because digital waveforms can be used only if the “variation button” and its del is “on” and also if one Digital partial is on.
                                  So, I think if only these 2 conditions are OK, so you can use Digital Waveforms.

                                  I’ve find also an error in the sysex adresses in the JD-XA for one Digital wave (named : “Sine-C”).
                                  To explain, you cannot reach it if you don’t pass with another waveform (the 01 named “JP-8 Saw”). You have to send in Sysex a mixed of the 6 sysex adresses and you can, with CTRLR “ON” the Digital waveform. I’m going to phone to Roland Europe to inform them (I’ve found yet some errors that Roland have corrected after in the last update).

                                  Is it normal that CTRLR runs more slowly after I have enter all the 16884 adresses ?

                                  Another question : In LUA, is it forced to respect the spaces between the words ?
                                  Because, I have sometimes some spaces (into sysex adresses, somtimes, between the 0xF0 and or other I have 5 or 6 spaces). I have used Notepad to make the code.).
                                  Well, I’m going to test your method !

                                  see you later,

                                  Xavier-Joseph from Reunion Island (Rain it’s also good for litchees and bananas !!!)

                                  • This reply was modified 7 years, 4 months ago by JDXA.
                                  • This reply was modified 7 years, 4 months ago by JDXA.
                                  #70702
                                  JDXA
                                  Participant
                                    • Topics: 10
                                    • Replies: 45
                                    • Total: 55

                                    Hello the world,

                                    I have put an answer but I see that it’s not present…

                                    So, nothing filter with Midi Monitor or MidiOX !

                                    I think the problem is these famous aditive adresses…

                                    I phone to Roland and they said that why it’s very complicated to do an editor !

                                    The JD-XA is very very complex in its memory organisation and even if you can filter sysex adresses you cannot reach directly !

                                    I’m very very patient and I continue to do my editor

                                    I inform you of the evolution…

                                    Have a nice day,

                                    Xavier-Joseph from Reunion Island.

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

                                      Hi, as always, before starting with something complex, start simple… 🙂

                                      In this case, take the example provided by Roland.
                                      Setting Reverb Type of Program to Room 2
                                      F0 41 10 00 00 00 0F 12 18 00 02 00 02 64 F7

                                      Check first with MidiOX and check the synth is reacting and changing.
                                      If yes, put this in a Ctrlr method that sends the message. Check Midi monitor and also that the synth is reacting.

                                      When this is working, we can tackle other or more complex parameters.

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

                                        i don’t now if you solved this? are you trying to just
                                        select waveforms? i don’t know the structure of the
                                        JDXA, and i’m looking at the manual and haven’t yet
                                        found anything but the ‘supernatural’ synth waveforms(7)

                                        the JV series select waveforms with 3 consecutive parameters,
                                        and these should be send in a concatenated sysex message,
                                        and checksummed together. you can actually do a limited
                                        version of it with just 2 and it will select only onboard waveforms,
                                        but you need at least those two.

                                        you can ‘concatenate’ consecutive parameters.
                                        you specify the first address, put in its value byte, and then
                                        put in the value byte of the next parameter, and then you
                                        checksum them together.

                                        so if you’ve got a 4 byte address; aaH bbH ccH ddH, followed by
                                        value vv, you put the next value after that, then the checksum,
                                        so you would have:

                                        F0H 41H 10H 16H 12H aaH bbH ccH ddH vvH vvH z6 F7
                                        z means checksum and 6 is the number of bytes you want to
                                        checksum
                                        (this is just a specimen header; aa, bb, cc, dd, are the address,
                                        and vv are values)
                                        if you have 469 waveforms, you are going to be using msb/lsb for
                                        the last value, so you’ll have another byte there, so that would
                                        mean have z7 instead. also, there may be weird roland numbering,
                                        in that is difficult to put on a single control. the JV goes up
                                        in groups of 16, so the MSB changes every 16 values – major pain.
                                        i put them in groups of 16 when i realised that. on the plus side,
                                        if you don’t mind using more controls/step buttons, you can be
                                        more specific on your UI about what is on each button, with
                                        descriptive names: having loads of different types of waveforms
                                        on a single knob is actually quite irritating to use (eg viz
                                        quasimidi rave o lution, the waveform select knob is horrible)

                                        hope this is useful.

                                        • This reply was modified 7 years, 2 months ago by human fly.
                                      Viewing 18 posts - 1 through 18 (of 18 total)
                                      • The forum ‘Programming’ 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