Forum

    • Register
    • Login
    • Search
    • Categories

    XY Pad Modulation

    Scripting Forum
    4
    12
    172
    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.
    • iamlamprey
      iamlamprey last edited by

      Figured I should start a new thread instead of hijacking the CUBE one 🙂

      I'm working on a modulation system for the XY Pad using Timers, and I can get it to go from 0 to 1 on an axis, then change directions once it reaches 1, but it's using an if statement to check if the current value is less than the "destination" value, so the instant it swaps directions and goes back to <1, it changes directions to positive again and gets stuck in a loop

      example gif: https://i.gyazo.com/db19c1d398f82935a38cdee71cf5eb4e.mp4

      chaosXDrift.setTimerCallback(function()
      {   
          if (Slider_MovementXInvisible.getValue() < chaosXTarget)
          {
              Slider_MovementXInvisible.setValue(Slider_MovementXInvisible.getValue() + 0.1);
              Console.print("Going Up");
          }
          else
          {
              Slider_MovementXInvisible.setValue(Slider_MovementXInvisible.getValue() - 0.1);
              Console.print("Going Down");
          }
       
          Panel_MovementXYPad.repaint();
      });
      

      I just want a simple "sine" movement but I can't wrap my brain around the best approach for the logic, any help is appreciated 🙂

      Music - Instruments

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

        @iamlamprey said in XY Pad Modulation:

        Not sure exactly what you are trying to do but wouldnt this work?

        reg dirSet = 0.1;
        chaosXDrift.setTimerCallback(function()
        {   
            if (Slider_MovementXInvisible.getValue() < 0.1)
            {
                dirSet = 0.1;
            }
             if (Slider_MovementXInvisible.getValue() > chaosXTarget)
            {
                dirSet = -0.1;
            }
            Slider_MovementXInvisible.setValue(Slider_MovementXInvisible.getValue() + dirSet);
            Panel_MovementXYPad.repaint();
        });
        

        HISE Development for hire.
        www.channelrobot.com

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

          @Lindon Yeh that does the same thing as my current script, the idea is:

          • Engine sets a "destination" XY coord
          • Timer checks if X and Y position are equal to, less than or greater than the destination
          • Timer either makes a new destination coord, adds 0.01 or subtracts 0.01 respectively

          It's like the timer isn't calling the new coordinate thing, even though i have console.print printing out both values and they do in fact match...

          Music - Instruments

          1 Reply Last reply Reply Quote 0
          • iamlamprey
            iamlamprey last edited by

            7a01393c-4fd3-4844-8fab-7d8b8fccc804-image.png

            Every time they both equal 0.86, it should "reroll" the target, but it's not, could that have something to do with deferred callbacks or something? Or variable scope?

            Music - Instruments

            1 Reply Last reply Reply Quote 0
            • iamlamprey
              iamlamprey last edited by

              Is there a way to reduce the number of decimal points from Math.random() ?

              Music - Instruments

              1 Reply Last reply Reply Quote 0
              • iamlamprey
                iamlamprey last edited by

                Ok got it working 🙂 I had to change all of my values to integers since the rounding was causing some issues

                Music - Instruments

                Adam_G 1 Reply Last reply Reply Quote 0
                • Adam_G
                  Adam_G @iamlamprey last edited by

                  hey @iamlamprey do you recall what number range you used when you did this? im trying to make it work with knobs that go from 0.0 - 1.0. I changed the knob to have a range of 0-100 but it reads 1000% instead lol. i know that im doing something wrong..

                  iamlamprey 1 Reply Last reply Reply Quote 0
                  • iamlamprey
                    iamlamprey @Adam_G last edited by

                    @Adam_G I don't remember off heart but the source for the XY pad I used is here:

                    https://github.com/nytemairqt/NEATplayer/blob/master/Scripts/MovementSettings.js

                    Music - Instruments

                    Adam_G 1 Reply Last reply Reply Quote 0
                    • Adam_G
                      Adam_G @iamlamprey last edited by

                      @iamlamprey thanks for replying. checking that out and looks like they used decimals too. am i reading that right?

                      Movement_Xpos = Math.range(Slider_MovementXInvisible.getValue() / 100, 0.03, 0.97);

                      iamlamprey 1 Reply Last reply Reply Quote 0
                      • iamlamprey
                        iamlamprey @Adam_G last edited by

                        @Adam_G hmm, i just opened the project and apparently the sliders that control the XY pad go from 0.0 to 100.0, the actual XY values i believe are 0.0 - 1.0

                        it's been a while since I've opened this project so its a bit hazy sorry, been working on other things

                        Music - Instruments

                        Adam_G 1 Reply Last reply Reply Quote 0
                        • Adam_G
                          Adam_G @iamlamprey last edited by

                          @iamlamprey thats definitely a hint haha, thanks again 🙂 ill keep trying

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

                            I made a couple of videos all about XY pads. Currently they're only available to Patrons.

                            https://www.patreon.com/posts/how-to-create-xy-68847672

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

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

                            22
                            Online

                            982
                            Users

                            6.6k
                            Topics

                            60.7k
                            Posts