HISE Logo Forum
    • Categories
    • Register
    • Login

    Change Slider Value via MIDI + Velocity

    Scheduled Pinned Locked Moved Scripting
    midivelocitysliderslider midislider velocity
    44 Posts 4 Posters 2.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • trillbillyT
      trillbilly @aaronventure
      last edited by

      @aaronventure @d-healey

      Yes, I figured this out right after posting. Simple and silly.

      Now, I'm trying to get the animation to happen only when certain keys are pressed. Right now Im working on C.

      I've got this in my oninit:

      const var slider = Content.getComponent("slider");
      
      const var keySwitchesC = [24, 36, 48, 60, 72, 84, 96, 108, 120]; //Cs
      
      inline function cAnimation(index)
      {   
          slider.setValue(value);
      }
      

      And this in my onNoteOn:

      function onNoteOn()
      {
      	
      	    if (keySwitchesC.indexOf(Message.getVelocity())) 
      	    {
      	        cAnimation(keySwitchesC.indexOf(Message.getVelocity()));
      	    }   
      	
      
      }
      

      If I replace my onNoteon with simply this:

       slider.setValue(Message.getVelocity());
      

      The animation works as expected but on every key instead of just Cs. Where am I going wrong?

      A 1 Reply Last reply Reply Quote 0
      • A
        aaronventure @trillbilly
        last edited by

        @trillbilly it looks like you're querying velocity instead of note number

        trillbillyT 1 Reply Last reply Reply Quote 0
        • trillbillyT
          trillbilly @aaronventure
          last edited by

          @aaronventure I have swtiched from "getVelocity" to "getNoteNumber" in the onNoteOn but still does not work. The animation does nothing.

          A LindonL 2 Replies Last reply Reply Quote 0
          • A
            aaronventure @trillbilly
            last edited by

            @trillbilly You're not passing anything to the setValue() method. Your parameters are not matching. value in this case is undefined.

            1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @trillbilly
              last edited by

              @trillbilly did you actually mean this:

              inline function cAnimation(index)
              {   
                  slider.setValue(index);
              }
              

              HISE Development for hire.
              www.channelrobot.com

              trillbillyT 2 Replies Last reply Reply Quote 0
              • trillbillyT
                trillbilly @Lindon
                last edited by

                @Lindon @aaronventure

                It is still not functioning.

                Now I've got this in on onInit:

                const var slider = Content.getComponent("slider");
                
                const var keySwitchesC = [24, 36, 48, 60, 72, 84, 96, 108, 120]; //Cs
                
                inline function cAnimation(index)
                {   
                    slider.setValue(index);
                }
                

                And this in my onNoteOn:

                function onNoteOn()
                {
                	//slider.setValue(Message.getVelocity());
                	
                	    if (keySwitchesC.indexOf(Message.getNoteNumber()))
                	    {
                	        cAnimation(keySwitchesC.indexOf(Message.getNoteNumber()()));
                	    }   
                }
                
                1 Reply Last reply Reply Quote 0
                • trillbillyT
                  trillbilly @Lindon
                  last edited by trillbilly

                  @Lindon @aaronventure @d-healey

                  Here is a minimal snippet. It's basically everything mentioned above.

                  HiseSnippet 1221.3oc0W0uSabDD+NaeU3Ksnjpzp9mqh5eXjbAeDJgJTULXfHTiAKNBsRUUnk6Fauh6185cqAbihTdz5iPeTxaP6r2c125fCww0ToZI9XmcmY9MeOtSrvCRRDwFlUOcXDXX94VtC4x9s5SYbiC2yvbYq1zDIDSxHs6vHZRB3aXZV9EJBlUqXj94cOeWZ.k6AEjLLNSv7fWxBYxBpcZ9SrffCn9vorPsWuQyC8D7Vh.w.DOksZXDQ8tj1CNhpdVIKCyOaeelTD6JoRHwvrxtB+gt8EWyyd+YrD1EAf5figKJnLxGHB7UHVQ0nUeVfemQ1chggoUmBuP4LuvisZy7YioW3MdX5EjBNz8GlklDdkm.dN5vqgF7lBjL0fTkLH8HKWuXVjr3FEddf0gbL3zkhtccnj8ViR8JY0RfufKWMjdIbPLdXLG01rQi5D7WqrssM55Sjjqnwjj.lOFu+QxHN6AxVhvHAGOT6IYW+jI44RXn60LoWeHoEx4ut9F0IOcy5jM1Rof5jmsdcxVHse.o4z.I5rdieaaxZq0Jw1lwCXbfzc.2SxDbh2NbVHU8u0Xbe3lUreMgPrwexw1pIf7LZv.H+9ssei8XtE7iDR3XdMjM6pqs16yRaz6gIUJq5LHP3wjCqsBJhp1UUZf0kTS2ZVMUEG2UmOkBNZP3EPLx4JY785r+n9ng+OEIoj01YR4MJ6spMZVjaYXc6lYYypcgxPSDpXZrHHPoPkTduqUUjS+lbFqwSQacLpiJc7CwzzIy8s9v495kldYoXZOTvOjyjGGA7OTAqQddopNIGU3SkoUIKmWk3l5bLXXwvRVYdJiTDiHyLsayqNbOpjNRFn3PUDAwRlB8l6AWgMtxp7pZsGjboTDk9175.CS6OtFuon4leygiO71yZhdQWIxVxXh+44Mw1rQtr+.z6oFx78CfNhDlJNTHhiadMyW1eLglPy9.qW+h9ruk1Ljdit7MtcWErelveP.UNYSNUm87KTZUuyhp6AGQyPcTtv57MqP7QVcTUUSGiklBFw.88AFymW7EV62sK3IK.XEqC9k6mgC5pe4L0+.KWrAZ5f6Tk+0omI+L8Jf7BfCwJmmycL69ul0Y2Qy7r6i8jn5OMlxShDISHXWHjcJVEknS7UI3zI32OQEM0o2RPim5Uu64GfF4T4wkJGDmlVrSnX.WNQZP46ZGBm4bGhJ2W6PTY1RSta38+fBeyRct0tnODSiCiBf84WgCzPJJL9kX23tzAAxQTmLutsfKh5K3LO8f9I.1rsWOHVG6S0f1QJwkNKn73lm.A.UOA9aa9RLwiFi9IXN8ENexq+M0302XkAWhpXj7uItsvSyVJC11Vi1EIEve03ijwliyGGsXugSoovQO5cENsVwTQXdOvicADLYfAajkqyTYjN0O8KSrnBWKjYVkmoYVK7vz7O+Zw.kSDCjLdu1Tr9D2UwB2E1EGg3AHR3bHPsIoYI0XfryMFs+lKv8SO723m7KcTmMyuzYzk+mniPpWr3bursQUkvKkRAsad5WdsJ9snwyDmwagZ0X0FF31cry87Tt6uC8OSmm0mCdd5bvyFyAOe+bvylyAOOaN3Yq6jG0L3cFHEYeQMLf1ty9Y8FL2mqZTjl0a7OvzVD4e
                  
                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @trillbilly
                    last edited by

                    @trillbilly Do you see the error in the console?

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    trillbillyT 1 Reply Last reply Reply Quote 0
                    • trillbillyT
                      trillbilly @d.healey
                      last edited by

                      @d-healey I messed up on naming the slider in the snippet. I have corrected it. Still does not work with the corrected slider names.

                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @trillbilly
                        last edited by d.healey

                        @trillbilly What error do you see? (Slider name seems fine to me btw)

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        trillbillyT 1 Reply Last reply Reply Quote 0
                        • trillbillyT
                          trillbilly @d.healey
                          last edited by

                          @d-healey Ahh, I see what you are mentioning now. I was equating it to the wrongly named slider.

                          Now I see the issue is this line

                          cAnimation(keySwitchesC.indexOf(Message.getNoteNumber()()));
                          

                          Where am I going wrong?

                          I've tried replacing it with

                          slider.setValue(Message.getVelocity());
                          

                          But again, it reacts to all keys and not only C.

                          d.healeyD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @trillbilly
                            last edited by

                            @trillbilly

                            cAnimation(keySwitchesC.indexOf(Message.getNoteNumber()()));

                            Look closely

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            A 1 Reply Last reply Reply Quote 0
                            • A
                              aaronventure @d.healey
                              last edited by

                              @d-healey Boobs!

                              trillbillyT 1 Reply Last reply Reply Quote 1
                              • trillbillyT
                                trillbilly @aaronventure
                                last edited by

                                @aaronventure @d-healey
                                I need a dunce cap and a beer because I am blind to this. Maybe I should continue banging my head on the keyboard until it works, I've done that a time or 2.

                                d.healeyD trillbillyT A 3 Replies Last reply Reply Quote 0
                                • d.healeyD
                                  d.healey @trillbilly
                                  last edited by

                                  @trillbilly 29cbc6a4-e019-4f56-8cba-24a8cf7b3d88-image.png

                                  Libre Wave - Freedom respecting instruments and effects
                                  My Patreon - HISE tutorials
                                  YouTube Channel - Public HISE tutorials

                                  1 Reply Last reply Reply Quote 0
                                  • trillbillyT
                                    trillbilly @trillbilly
                                    last edited by

                                    @aaronventure @d-healey Yes, the boobs remark makes sense now. Now it is working on just the C but seems to be limited.

                                    I have the slider set to min 0 - max 127 with steps 1.0.

                                    With the new code, it doesn't surpass 3.

                                    Should I be setting the slider up differently in this sense or am I missing something else.

                                    d.healeyD 1 Reply Last reply Reply Quote 0
                                    • d.healeyD
                                      d.healey @trillbilly
                                      last edited by d.healey

                                      @trillbilly You are passing the index of the array, based on the note you play. So if you play note 24 the knob will be set to 0, if you play 36 the knob will be set to 1, etc.

                                      Libre Wave - Freedom respecting instruments and effects
                                      My Patreon - HISE tutorials
                                      YouTube Channel - Public HISE tutorials

                                      trillbillyT 1 Reply Last reply Reply Quote 0
                                      • trillbillyT
                                        trillbilly @d.healey
                                        last edited by

                                        @d-healey Thanks. Now Im super confused how to now make it follow the velocity modulator. I will continue tinkering with it.

                                        If you have time for a snippet or anything it would be super appreciated.

                                        d.healeyD 1 Reply Last reply Reply Quote 0
                                        • d.healeyD
                                          d.healey @trillbilly
                                          last edited by

                                          @trillbilly If you want your knob to have the same value as the incoming velocity then you have that in my first response. If you only want to respond to certain notes then use an if statement to check if the incoming note is in your array before you set the knob's value.

                                          Libre Wave - Freedom respecting instruments and effects
                                          My Patreon - HISE tutorials
                                          YouTube Channel - Public HISE tutorials

                                          trillbillyT 1 Reply Last reply Reply Quote 0
                                          • trillbillyT
                                            trillbilly @d.healey
                                            last edited by

                                            @d-healey yes, I've put

                                            slider.setValue(Message.getVelocity());
                                            

                                            within the IF statement in the onNoteOn like so:

                                            	    if (keySwitchesC.indexOf(Message.getNoteNumber()))
                                            	    {
                                            	        cAnimation(keySwitchesC.indexOf(Message.getNoteNumber()));
                                            	        
                                            	        slider.setValue(Message.getVelocity());
                                            	    }  
                                            

                                            But is apparently incorrect as it then changes to all keys again instead of just C.

                                            I will keep plugging away.

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            11

                                            Online

                                            1.7k

                                            Users

                                            11.9k

                                            Topics

                                            103.5k

                                            Posts