HISE Logo Forum
    • Categories
    • Register
    • Login

    Arp plays in key?

    Scheduled Pinned Locked Moved General Questions
    25 Posts 5 Posters 1.0k 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.
    • d.healeyD
      d.healey @MikeB
      last edited by

      @MikeB Ah that's different, I thought you wanted the arp to do something it wasn't meant to. What you want to do is within your GUI script, correct? You can use the Math.random or Math.randInt function to generate a random number which you assign to your slider pack slider.

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

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

        @d-healey

        //Random Note Button-----------------------------------------------------------------------
        inline function onbtnRandomNote_S1Control(component, value)
        {        if(value) {  
                for (i = 0; i < 16; i++){  
                    local r = Math.randInt(-12, 12);
                    myPads_S1[i].setValue(r);
                    SliderPack1_S1.setSliderAtIndex(i, r); }            
               }
        };
        Content.getComponent("btnRandomNote_S1").setControlCallback(onbtnRandomNote_S1Control);
        //----------------------------------------------------------------------------------
        
        

        I already have that - but with Math.random and/or Math.randInt, only between whole numbers are selected, for example between -12 and 12 - in this case, however, certain numbers within -12 / 12 are not to be selected (because they do not occur in the selected key, for example 5).

        So I need a random function that only selects between the numbers 1 2 3 4 6 7 8 9 10 11 12 and leaves out 5. As an example.

        "One hour of trial and error can save 10 minutes of reading the manual."
        "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
        HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

          @MikeB Make an array that has the numbers you want. Use the random function to generate an index that you can use to get the value of an element in the array.

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

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

            @d-healey Do you have a small example that I can look at and understand?

            "One hour of trial and error can save 10 minutes of reading the manual."
            "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
            HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

              @MikeB

              const valuesIWant = [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12];
              
              Console.print(valuesIWant[Math.randInt(0, valuesIWant.length)]);
              

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

              MikeBM 1 Reply Last reply Reply Quote 1
              • MikeBM
                MikeB @d.healey
                last edited by

                @d-healey
                Super thanks Sir David. I got it - now even better with your example.

                I thank you for your great support this year and wish you a happy and successful new year.

                "One hour of trial and error can save 10 minutes of reading the manual."
                "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                  @MikeB You're most welcome. Happy New Year!

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

                  DanHD 1 Reply Last reply Reply Quote 0
                  • MikeBM
                    MikeB @Lindon
                    last edited by

                    @Lindon said in Arp plays in key?:

                    @MikeB

                    Write your own Arp.

                    It was easier in this case - Happy and prosperous New Year to you.

                    "One hour of trial and error can save 10 minutes of reading the manual."
                    "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                    HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

                    1 Reply Last reply Reply Quote 0
                    • MikeBM
                      MikeB @Christoph Hart
                      last edited by MikeB

                      @Christoph-Hart
                      Thanks to David, I found an easier solution. A happy and successful new year to you.

                      After two years of peace and quiet here in Berlin, we'll have a lot of noise in front of the house again in a few hours. :-)

                      "One hour of trial and error can save 10 minutes of reading the manual."
                      "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                      HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                        @d-healey just trying this - the console prints correct values but the sliderpack continues to set random values, rather than values in the specified array. Am I doing something stupid?!

                        HiseSnippet 1225.3ocsW8+SaaDE+b.W03tV0N0+.NwurD0T23PJkIFZIjD1hFDxHYnNgPUG1WH2v9tH6KTxlPZZ+Eu+C1d2YmXGHM.QpVg.uudedu68d9Q2PgKMJRDhLx2exHJx3aL6MgKG1XHgwQsahLdg4gjHIMDGyZuIiHQQTOjgwZ+jhgQ90Q5m+8G2i3S3tzTVHzIBlK8.V.Slxsaseg46uOwi1mEjQ6p0Z6J3MD9hw.dVyrLZDw8RxEzNDkZ4LQFOokGSJB6IIRZDnydBuI8FJ9LOV+SXQry8oJBGTOvQwrQMFx785NMViPHi06lF4qEG4u17PlGaF+zLvK0BvoVjMGXjaYPx4Q.IiLPZ8XH8JydtgrQxTIJ77Ly1b3BY.AR0YgRrtnbemoYCAnAWZGPtjteHPLyhBaUtbIL7UwcrrfzcjDeEIDGv3hP7t3SAgUJg2rD98kvenDd6RXGfkCvyoJ7Cv0AX678fZJUA9Upd1NY7DjEjJGUQ6nGzm4rOf7GYQR0oHANQGGPyrnt9wc60n9As.0mFwWPkMDAiDbfnvFSUXihYOhd9LOZXWn3x4KZYFcTFaw39LNEOXL2UxDbrfC9935cZdzgJGDJ7K3N05Rvo3OlVz5urxyFfKLEEpi3DkjBEw6tK1onUdPi7Cf3s.CPR4cvL7Ofc1B98adCHMO7Am77t2kAR1QTYLYc3p0idcAVI7gD4P6PB2CtrK71JUUWMEArm5iL+I.5HgO0dTHSEtwQhNRyeiU9kh6JOJb+nPMbmqqDs8o7KjCuC5uEpOrcmiNdCsRyKQ6jSWpqOaluu+HdyupQrpiYt.9VQoRNDjKHAr3vLq+NK1tarzA5cu3WP.CP3FnL3K1PMsTQEaIk9MH99mCwag61UTbmLsLcDR5Q7B5FCK.S2VzfAKTVhq7ogKTr5sHgKyvB7wAmSCy1VpTDFyN+r6m7vlc6FmYxnnf2lyjGMhlPuuv2SMSV822cROJI0By7ykfP.JR8D+uMYheZMDhAN54lYJpP5vH88lutlGQRPFmZtUUa3YS6511CZzzN4oYcf9plJ59cgu5pns0x6nn+YE8.s7eUQ2WQ2USu4QZOTOFyZftVLPeYBPgZiyE6ItVCSKyo0S2FinZneqcSELg2TkD+PNYDMTxTodilzqfMEhesWdylznKkhQvoMq1CY7zGQJ55YG8eeZsIo3nYsOy7jCQFlF0LPngT1ECkJp+ADFPRMCscMXqmQ8X+Ic58XJRdRLRdQBR1arTJ3ZT7LyYM.Yv.52yhAVMJm.0UpsJNfRB4pWdGQth1l2MjBcUJ5Ebb2WJO87vgyed5.yDbJPHoAQpkchAokdDpU+V85aAalcmMPfceDdi8Ix4WHRs4Wh.nSatsPTaZviXxIY2L7QrkT4ktkzCEhuxrKS5NbwXL2BvnpY7q.FS1s74lsFLf5JSA35l6+wUcQx643OVLVx3W.uVHjot26LNnGrRsKENcNm5GopExolCESWVQqx.8nbOMw+AOIBcTzFIBclJDZUbCEexMdnfZ60mp4.XhqWVOO7eM.z3YCqLMKaWFE.k7ex0UE9u0AgVrMUVAa1bEro5JXy6WAa1ZEr4CqfMauTaTSapOVJBhaG.FcaoGHaXzRONRWEh9esZ6tKA
                        

                        EDIT: Actually the console values are random even with the test array which is just a bunch of '2's

                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                        https://dhplugins.com/ | https://dcbreaks.com/
                        London, UK

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

                          @DanH

                          the sliderpack continues to set random values

                          That's because you are setting random values... what size t-shirt do you want?

                          SliderPack1.setSliderAtIndex(i, Math.randInt(0, minor.length));

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

                          DanHD MikeBM 2 Replies Last reply Reply Quote 0
                          • DanHD
                            DanH @d.healey
                            last edited by

                            @d-healey XXXL please 😁

                            DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                            https://dhplugins.com/ | https://dcbreaks.com/
                            London, UK

                            1 Reply Last reply Reply Quote 2
                            • MikeBM
                              MikeB @d.healey
                              last edited by

                              @d-healey What would be the right approach here?

                              "One hour of trial and error can save 10 minutes of reading the manual."
                              "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                              HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                                @MikeB To what?

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

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

                                  @d-healey So that DanH's snippet above works!

                                  "One hour of trial and error can save 10 minutes of reading the manual."
                                  "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                                  HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                                    @MikeB It does work, it does exactly what he told it to do.

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

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

                                      @d-healey You already said that above.
                                      But it should do the following.

                                      Randomise the random area of the slider pack or the individual sliders exactly between the values defined in an array.

                                      So if the array contains [0, 2, 3, 5, 7, 8, 10, 12 ], no slider in the slider pack may have the value 4 or 6 or 9 etc. when the Random button is clicked.

                                      Instead, only a random within the defined values.

                                      This way you can make the Arp randomise within a defined key.

                                      "One hour of trial and error can save 10 minutes of reading the manual."
                                      "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                                      HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

                                      d.healeyD DanHD 2 Replies Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey @MikeB
                                        last edited by

                                        @MikeB

                                        But it should do the following.

                                        He isn't pulling values from the array he's just assigning random values.

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

                                        1 Reply Last reply Reply Quote 0
                                        • DanHD
                                          DanH @MikeB
                                          last edited by

                                          @MikeB

                                          SliderPack1.setSliderAtIndex(i, valuesIWant[Math.randInt(0, valuesIWant.length)]);
                                          

                                          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                          https://dhplugins.com/ | https://dcbreaks.com/
                                          London, UK

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

                                          10

                                          Online

                                          1.7k

                                          Users

                                          11.8k

                                          Topics

                                          103.2k

                                          Posts