Forum
    • Categories
    • Register
    • Login

    Change Slider Value via MIDI + Velocity

    Scheduled Pinned Locked Moved Scripting
    midivelocitysliderslider midislider velocity
    44 Posts 4 Posters 9.7k 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.
    • soundsyncS
      soundsync
      last edited by

      Hey Gang,

      Im getting hung up a bit here. I'm trying to change the value of a slider via MIDI + Velocity.

      For example, say a user presses C0 on the keyboard at a velocity of 63, the slider would change value to match the velocity of said key.

      Any help or snippets would be greatly appreciated.

      Best,

      Aaron
      https://soundsync.dev
      https://moonwavefx.com

      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @soundsync
        last edited by

        @trillbilly slider.setValue(Message.getVelocity())

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - HISE tutorials
        My Patreon - More HISE tutorials

        soundsyncS 2 Replies Last reply Reply Quote 0
        • soundsyncS
          soundsync @David Healey
          last edited by

          @d-healey Well, no shit. Thank you.

          Best,

          Aaron
          https://soundsync.dev
          https://moonwavefx.com

          1 Reply Last reply Reply Quote 0
          • soundsyncS
            soundsync @David Healey
            last edited by soundsync

            @d-healey What is the best way to get the slider to return to 0 following the release of the key? A timer?

            Best,

            Aaron
            https://soundsync.dev
            https://moonwavefx.com

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

              @trillbilly Probably the on note off callback.

              soundsyncS 1 Reply Last reply Reply Quote 0
              • soundsyncS
                soundsync @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?

                Best,

                Aaron
                https://soundsync.dev
                https://moonwavefx.com

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

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

                  soundsyncS 1 Reply Last reply Reply Quote 0
                  • soundsyncS
                    soundsync @aaronventure
                    last edited by

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

                    Best,

                    Aaron
                    https://soundsync.dev
                    https://moonwavefx.com

                    A LindonL 2 Replies Last reply Reply Quote 0
                    • A
                      aaronventure @soundsync
                      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 @soundsync
                        last edited by

                        @trillbilly did you actually mean this:

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

                        HISE Development for hire.
                        www.channelrobot.com

                        soundsyncS 2 Replies Last reply Reply Quote 0
                        • soundsyncS
                          soundsync @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()()));
                          	    }   
                          }
                          

                          Best,

                          Aaron
                          https://soundsync.dev
                          https://moonwavefx.com

                          1 Reply Last reply Reply Quote 0
                          • soundsyncS
                            soundsync @Lindon
                            last edited by soundsync

                            @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
                            

                            Best,

                            Aaron
                            https://soundsync.dev
                            https://moonwavefx.com

                            David HealeyD 1 Reply Last reply Reply Quote 0
                            • David HealeyD
                              David Healey @soundsync
                              last edited by

                              @trillbilly Do you see the error in the console?

                              Free HISE Bootcamp Full Course for beginners.
                              YouTube Channel - HISE tutorials
                              My Patreon - More HISE tutorials

                              soundsyncS 1 Reply Last reply Reply Quote 0
                              • soundsyncS
                                soundsync @David 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.

                                Best,

                                Aaron
                                https://soundsync.dev
                                https://moonwavefx.com

                                David HealeyD 1 Reply Last reply Reply Quote 0
                                • David HealeyD
                                  David Healey @soundsync
                                  last edited by David Healey

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

                                  Free HISE Bootcamp Full Course for beginners.
                                  YouTube Channel - HISE tutorials
                                  My Patreon - More HISE tutorials

                                  soundsyncS 1 Reply Last reply Reply Quote 0
                                  • soundsyncS
                                    soundsync @David 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.

                                    Best,

                                    Aaron
                                    https://soundsync.dev
                                    https://moonwavefx.com

                                    David HealeyD 1 Reply Last reply Reply Quote 0
                                    • David HealeyD
                                      David Healey @soundsync
                                      last edited by

                                      @trillbilly

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

                                      Look closely

                                      Free HISE Bootcamp Full Course for beginners.
                                      YouTube Channel - HISE tutorials
                                      My Patreon - More HISE tutorials

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

                                        @d-healey Boobs!

                                        soundsyncS 1 Reply Last reply Reply Quote 1
                                        • soundsyncS
                                          soundsync @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.

                                          Best,

                                          Aaron
                                          https://soundsync.dev
                                          https://moonwavefx.com

                                          David HealeyD soundsyncS A 3 Replies Last reply Reply Quote 0
                                          • David HealeyD
                                            David Healey @soundsync
                                            last edited by

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

                                            Free HISE Bootcamp Full Course for beginners.
                                            YouTube Channel - HISE tutorials
                                            My Patreon - More HISE tutorials

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            24

                                            Online

                                            2.9k

                                            Users

                                            14.0k

                                            Topics

                                            121.6k

                                            Posts