basic help needed with formatting message of a button

Home Forums General Programming basic help needed with formatting message of a button

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #53004
    prprp
    Participant
      • Topics: 1
      • Replies: 1
      • Total: 2

      Hi,
      I’m not too good with programming techniques, nor am I particularly knowledgeable with LUA or other programming languages, but I started designing an editor for a SIEL DK700 and I struggle to solve an unfortunate difficulty.

      As far as I can tell, buttons only output consecutive values starting with 0 and going up to however many lines you enter in the “button values” box minus 1. Stop me here if I’m wrong.

      I need to generate a sysex code that would translate in decimal values as :
      first button position (first value) : 1
      second button position (second value) : 2
      third button position (third value) : 4

      Clicking on the button a fourth time would go back to the first value.

      I cant come up with an arithmetic way to transform the “0, 1, 2” output into “1, 2, 4”. Has anybody any idea how to proceed – either via a mathematical expression or a programming technique?

      I don’t know where else to ask so I hope someone here will be able to help… Thanks in advance to anybody willing to look into it.

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

        In the button values box, you can assign a value to each line:

        0 = 1
        1 = 2
        2 = 4

        #53021
        Puppeteer
        Participant
          • Topics: 16
          • Replies: 185
          • Total: 201
          • ★★

          As Dasfaker is written it will output the correct values, but the display in the button will cycle through 0,1,2.

          To make it cycle through 1,2,4 and output the correct values put this in the uiButtonContent Box

          1=1
          2=2
          4=4

          or you could do something like

          Lopass = 1
          Hipass = 2
          Bandpass = 4

          The expression before the equals sign is what is displayed. The value after the equals sign is what is output.

          • This reply was modified 8 years, 9 months ago by Puppeteer.

          The Puppeteer
          http://godlike.com.au

          #53032
          prprp
          Participant
            • Topics: 1
            • Replies: 1
            • Total: 2

            thanks a lot for the input guys, for a moment i thought i was out of trouble… but i just tried it and it doesnt seem to work for me.

            I haven’t said above that I do this in LUA :
            a = panel:getModulatorByName(“Button”):getValue()

            and then include this value as a broader part of a sysex message. But it seems that the method with the equal signs in the button value box doesn’t change the “modulator value” field so it still produces a “0, 1, 2” output.

            Any more ideas?

            • This reply was modified 8 years, 9 months ago by prprp.
            #53038
            dasfaker
            Keymaster
              • Topics: 80
              • Replies: 793
              • Total: 873
              • ★★★

              In this case you need a = panel:getModulatorByName(“Button”):getValueMapped()

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

                Thx for your explanation Puppeteer (and dasfaker) ! I was also looking for this and was sure to find it in the forum 🙂
                I’ll add your explanation in the user guide.
                About that one, I’ll keep a post with a “released” version then I will create another post with “in dev” version so other people can write.
                I started with some LUA programs…

                #53787
                Puppeteer
                Participant
                  • Topics: 16
                  • Replies: 185
                  • Total: 201
                  • ★★

                  I’ve started making notes for Chapter 3. Hopefully I’ll get the last bit of my panel out of the way tonight and can spend a little bit of time on chapter 3 shortly.

                  The Puppeteer
                  http://godlike.com.au

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

                    Hi again,
                    to come back on this topic it is worth adding some precision to what Puppeteer explained above…
                    There are 3 things to consider: the text that will be displayed, the value to test in the Lua code and the value that is send by Midi.

                    • The text to display (you need to have Text position different than “none”) is what’s come on the left side of “=” sign
                    • The value sent by Midi is on the right side of the equal sign
                    • The value to test in your Lua code is the rank of each line starting by 0

                    On the Moog Sub37, there is a button that indicates the destination of the pitch modulation (Osc1+Osc2, Osc1, Osc2). CC is 88 and Midi values to send are 0, 43 and 85. The destination is indicated on the synth by 2 leds (1 and 2).
                    The Lua code is used to set the corresponding LEDs ON depending on each button press.

                    So, for button values I have:
                    Osc1+Osc2=0
                    Osc1=43
                    Osc2=85
                    (I set Text position to top just for testing purposes, otherwise it is none.)

                    In the Lua code I have:

                    function mod2OscSelect(modulator, modValue)
                    
                    	-- console ("Value: " .. modValue)
                    	if modValue==0 then
                    		-- console ("Osc1+Osc2")
                    		panel:getComponent("ledMod2Osc1Pitch"):setValue(1,true)
                    		panel:getComponent("ledMod2Osc2Pitch"):setValue(1,true)
                    	end
                    	if modValue==1 then
                     		-- Send 43 to Midi
                    		-- console ("Osc1")
                    		panel:getComponent("ledMod2Osc1Pitch"):setValue(1,true)
                    		panel:getComponent("ledMod2Osc2Pitch"):setValue(0,true)
                    	end
                    	if modValue==2 then
                     		-- Send 85 to Midi
                    		-- console ("Osc2")
                    		panel:getComponent("ledMod2Osc1Pitch"):setValue(0,true)
                    		panel:getComponent("ledMod2Osc2Pitch"):setValue(1,true)
                    	end
                    end

                    Checked on the panel and with the synth.

                    • This reply was modified 8 years, 8 months ago by goodweather.
                  Viewing 8 posts - 1 through 8 (of 8 total)
                  • The forum ‘Programming’ is closed to new topics and replies.
                  There is currently 0 users and 91 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