HISE Logo Forum
    • Categories
    • Register
    • Login

    XY Pad Modulation

    Scheduled Pinned Locked Moved Scripting
    12 Posts 4 Posters 749 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.
    • ?
      A Former User
      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 :)

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @A Former User
        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

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @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...

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User
            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?

            1 Reply Last reply Reply Quote 0
            • ?
              A Former User
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • ?
                A Former User
                last edited by

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

                Adam_GA 1 Reply Last reply Reply Quote 0
                • Adam_GA
                  Adam_G @A Former User
                  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..

                  ? 1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @Adam_G
                    last edited by

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

                    Link Preview Image
                    Build software better, together

                    GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

                    favicon

                    GitHub (github.com)

                    Adam_GA 1 Reply Last reply Reply Quote 0
                    • Adam_GA
                      Adam_G @A Former User
                      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);

                      ? 1 Reply Last reply Reply Quote 0
                      • ?
                        A Former User @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

                        Adam_GA 1 Reply Last reply Reply Quote 0
                        • Adam_GA
                          Adam_G @A Former User
                          last edited by

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

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

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

                            Just a moment...

                            favicon

                            (www.patreon.com)

                            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

                            17

                            Online

                            1.8k

                            Users

                            12.1k

                            Topics

                            104.9k

                            Posts