HISE Logo Forum
    • Categories
    • Register
    • Login

    Updating a knobs min/max/middlePosition parameters - why is it limited to 100,000 ?

    Scheduled Pinned Locked Moved Solved General Questions
    20 Posts 4 Posters 723 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.
    • O
      Orvillain @Christoph Hart
      last edited by

      @Christoph-Hart said in Updating a knobs min/max/middlePosition parameters - why is it limited to 100,000 ?:

      But apart from that, something is funky indeed:

      const var Knob1 = Content.getComponent("Knob1");
      
      Knob1.set("max", 100000); // sure, no problem
      Knob1.set("max", 100001); // nope nope nope, I'm out of here...
      

      Yeah, defo something funky!

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • O
        Orvillain @Christoph Hart
        last edited by

        @Christoph-Hart said in Updating a knobs min/max/middlePosition parameters - why is it limited to 100,000 ?:

        I figured that taking the 0.0 - 1.0 range would eventually require me to perform some rounding math in order to arrive at my sample integers, and that doesn't seem entirely sensible?

        The double precision should be enough to round a few million samples correctly - you get 14 digits of accuracy which is 10^14.

        Hmmmm. If I log the value coming into my SNEX node, I don't get that much precision. I'm getting this sort of precision:

        Line 0: 0.788
        Line 0: 0.796
        Line 0: 0.812
        Line 0: 0.82
        Line 0: 0.828
        Line 0: 0.836
        Line 0: 0.844
        Line 0: 0.852
        Line 0: 0.86
        Line 0: 0.868
        Line 0: 0.88
        Line 0: 0.884
        Line 0: 0.888
        Line 0: 0.892
        Line 0: 0.908
        Line 0: 0.916
        Line 0: 0.932
        Line 0: 0.924
        Line 0: 0.92
        

        That is just printing the parameter out directly. The step-size is set to 0. But even if I set it to something like 0.0001, I still don't get much more precision.

        1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart @Orvillain
          last edited by

          Ooopsies, that's on me:

          if (min >= max || stepsize <= 0.0 || min < -100000.0 || max > 100000.0)
                setRange(0.0, 1.0);
          

          I'm not sure in what mental state I was when I wrote those lines a few years ago (probably trying to catch 1/0 bugs), but that was way too defensive.

          I bumped the limit to 10 million (much zeroes now) and added an error message that doesn't just silently fail anymore.

          O 1 Reply Last reply Reply Quote 2
          • O
            Orvillain @Christoph Hart
            last edited by

            @Christoph-Hart said in Updating a knobs min/max/middlePosition parameters - why is it limited to 100,000 ?:

            Ooopsies, that's on me:

            if (min >= max || stepsize <= 0.0 || min < -100000.0 || max > 100000.0)
                  setRange(0.0, 1.0);
            

            I'm not sure in what mental state I was when I wrote those lines a few years ago (probably trying to catch 1/0 bugs), but that was way too defensive.

            I bumped the limit to 10 million (much zeroes now) and added an error message that doesn't just silently fail anymore.

            Awesome! Thanks for looking into this!

            O 1 Reply Last reply Reply Quote 0
            • O
              Orvillain @Orvillain
              last edited by

              So I did actually do what @aaronventure suggested, and I stuck with 0.0 - 1.0 for the knob, and then converted that to a sample reference in the SNEX node itself.

              But I would guess with this fix, my original intention was actually fairly sound - to set the min and the max of the UI knobs as well as the min and max of the SNEX parameters to values corresponding to the loaded audio file.

              My question @Christoph-Hart if I've still got your attention is, how can I set the value of the SNEX parameters?

              Because previously when doing node.set("max", 123456) it didn't seem to be working. Would that be because of this same dodgy min/max check and silent fail???

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @Orvillain
                last edited by

                I would refrain from programatically setting the max value of the SNEX node directly. Can you use the minmax node and then set the Maximum parameter to the sample count? This node has the exact purpose of avoiding fiddling with the parameter ranges directly.

                O 2 Replies Last reply Reply Quote 0
                • O
                  Orvillain @Christoph Hart
                  last edited by

                  @Christoph-Hart said in Updating a knobs min/max/middlePosition parameters - why is it limited to 100,000 ?:

                  I would refrain from programatically setting the max value of the SNEX node directly. Can you use the minmax node and then set the Maximum parameter to the sample count? This node has the exact purpose of avoiding fiddling with the parameter ranges directly.

                  Sorry, I'm an idiot. I didn't mean the SNEX node itself. I meant the DspNetwork parameter I have that is called "Loop End" - I'd like to be able to specify its min and max.

                  I don't quite know how the minmax node works, but I can take a look at it.

                  1 Reply Last reply Reply Quote 0
                  • O
                    Orvillain @Christoph Hart
                    last edited by

                    @Christoph-Hart said in Updating a knobs min/max/middlePosition parameters - why is it limited to 100,000 ?:

                    I would refrain from programatically setting the max value of the SNEX node directly. Can you use the minmax node and then set the Maximum parameter to the sample count? This node has the exact purpose of avoiding fiddling with the parameter ranges directly.

                    Hey Christoph,
                    To set the minmax maximum parameter to the same as the sample count, would I need to setup a modulation output on the SNEX node to pipe it in?

                    I tried doing node.set("Maximum", sampleCount) and it didn't work either. It doesn't seem like trying to set the min/max of any nodes is working, and again, the documentation seems to imply that it should?

                    Christoph HartC 1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart @Orvillain
                      last edited by

                      I think you're overcomplicating things here. You want to select the loop range on the UI using sample values (from 0 to whatever number of samples the currently loaded file has) and send that to the SNEX node, right? Because then you don't need to do any scaling / max parameter range setting at all.

                      Here's a snippet that isolates the idea:

                      1. A knob on the UI hardcoded with 0 - 60000. Note that this can be any value
                      2. A DSP network parameter. with the range 0...1
                      3. A SNEX node with a single parameter and the range 0...1
                      4. The SNEX node just stores the incoming parameter value into an integer (use the SNEX variable watch to inspect the correct value).

                      The only thing you need to make sure is that the range of the DSP network parameter and the SNEX target parameter is equal. If that is the case, then the parameter will completely ignore the range and just forward whatever input is coming from the UI Knob.

                      de258dbc-c7b2-4de0-a220-4575f811781b-image.png

                      HiseSnippet 1602.3ocuW0saaaCElxIJs1cqqEX2ML.hbQgCPVh8VWWAx+I1d0nMNFUoA4NCFI5XhHQJHQmXugBrK2yztpuA6Io.8MX6bnjrjiSZSM5lKPsIO+xyOemS3izboG2qWrTDFx0Dh0BciTt73XUDwp7wiC4Dqux1YrTO3fALgjztAw5g1Gxh07HZxU6ONjEGy8HVVK7q3EVkWjX97gc1m4yjt77qHjSTBW9qDABc9sc28kBe+VLO9whfBb+zca6pjGn7UCA+YA6ZjPl6Ery4cXHakrIVK0zSnUQNZllGC7ruxary.0UxD9OQDKNymiGpSb.EkbM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TyjXI2ftDmNXN8XZkexPu7xjt25zv8UpKBXll34ZR++KPNAL2HUO2DTT7EeeyM.LnzrLcYXqd3L8ZqufeBfkc645NsplQvebdE7mlWAe57J3OOuB9r4UveYdE74eZAw+VjzNMr5EZU51zTDZY0ThnIFjMBGla5AK6lL5FqUmbCTimBsXUpu.mRZ9JwS9t7df0mBNasAYKXSJ89R1ZNfiAM6zMERMsyIaSi0QCc0zoDBGX6zo4o85bTilUmhzJa.yxKu95TbEcAyWDyo5A7rUDfFDJL1xMlNfGwqT9RkvKamipcS91wPODVfnLXGPauEUI5OlnHcKZsLi7ZdLWec8GJB49vrshlHBYr5zZDjOcmAiFhEmKY9oBkGGvc1wXXFuXRA682ll56laqdMpOg5A+5tXOVLsOBBMigwG7ASakVHiUiCYxM66qX5UAFJZoaxLG1tQaJ+RHAOULGfY774u.ROMQZUm7qmP4y31uwjDEw4qxoUTHfNLzXB9H.AEeKnmjpefZyzqwXRUnHKVSKdE33qRwGoP5wGMiMcxRrSF3biQntoQHvdS.yq5oFBcLzKSUZVYSUPfUtbCzFuciJDxLcIe+s1kLJveReh0eYu4NvEzKS11Zqkg+frkovNXJOn9aqkeyws9gmu7NaWoxl4iK2tBklejlMcbqkqgBmMXLUWYyDSolONLgNnpBeZ2Xqkmn3koET65aWYy0K5BDx+xHRvhR
                      
                      O 1 Reply Last reply Reply Quote 2
                      • O
                        Orvillain @Christoph Hart
                        last edited by Orvillain

                        @Christoph-Hart said in Updating a knobs min/max/middlePosition parameters - why is it limited to 100,000 ?:

                        I think you're overcomplicating things here. You want to select the loop range on the UI using sample values (from 0 to whatever number of samples the currently loaded file has) and send that to the SNEX node, right? Because then you don't need to do any scaling / max parameter range setting at all.

                        Here's a snippet that isolates the idea:

                        1. A knob on the UI hardcoded with 0 - 60000. Note that this can be any value
                        2. A DSP network parameter. with the range 0...1
                        3. A SNEX node with a single parameter and the range 0...1
                        4. The SNEX node just stores the incoming parameter value into an integer (use the SNEX variable watch to inspect the correct value).

                        The only thing you need to make sure is that the range of the DSP network parameter and the SNEX target parameter is equal. If that is the case, then the parameter will completely ignore the range and just forward whatever input is coming from the UI Knob.

                        de258dbc-c7b2-4de0-a220-4575f811781b-image.png

                        HiseSnippet 1602.3ocuW0saaaCElxIJs1cqqEX2ML.hbQgCPVh8VWWAx+I1d0nMNFUoA4NCFI5XhHQJHQmXugBrK2yztpuA6Io.8MX6bnjrjiSZSM5lKPsIO+xyOemS3izboG2qWrTDFx0Dh0BciTt73XUDwp7wiC4Dqux1YrTO3fALgjztAw5g1Gxh07HZxU6ONjEGy8HVVK7q3EVkWjX97gc1m4yjt77qHjSTBW9qDABc9sc28kBe+VLO9whfBb+zca6pjGn7UCA+YA6ZjPl6Ery4cXHakrIVK0zSnUQNZllGC7ruxary.0UxD9OQDKNymiGpSb.EkbM4fABeuIu0X3kuXgW9BIu7u09PgmXx84QfGYHPyknXLvpzGykp+Y3RVEboESboGa63FIB04TP+4A1skPBoOCB0EckDdIVuy9.EvfTuV.6BdqH3vDAp9rZ0VkB+2JazenzUKTRpR1Qo4GIqtRkeuR4JusB85j52+FoglIR46yitQxX1M5iIXU4vfy3QqRuj4OjOgQ34OcLco6VL0M4UWfQkrsTnOJjmdtkx2CiU3umMCPRCaXtH0CAV0lLwCSyDN9BOdDQ.J4d1uTpNqNw37YUw+w9+8tj2ztASyxTCnQvJg7Hs.eLVM3WB8DII3x1M3wWnUgFdCBURz9V2+SZzQSZad2o6NNuGZvtPuZni32.wssquVMR.Km2W89cCydvs8LM6FCPacZcnYKB5yf5DjxCr6lcDZXmovDZITdC8Y5o6SP.gTBPhdphSrBTFKziKBX7Yz7T6i17bWcwGa2UncGby9XoavGgj3+E9XJjyWa2reetqN2AWzt0oyK9RsOa7kJo4evlnwmpb3lPV9S67t3vHNTwvOV00mMtZLKHzm+ZvGWkdlux8BrDb1V+zpu8QNp5NfIkb+34AgXouPntjWqFpExyOjoiDPihcmgANv7GW9AodGbmUIDbH4bM7LVW3.CSMG9G3SJw53YqTh0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NaWoxl4iK2tBklejlMcbqkqgBmMXLUWYyDSolONLgNnpBeZ2Xqkmn3koET65aWYy0K5BDx+xHRvhR
                        

                        Interesting. That's how I had it setup before, and I wasn't getting the precision that this snippet gives, at all. I'll do some debugging and check what I might've got wrong.

                        But yes, I can see from this snippet that I wouldn't need to set the min/max of the nodes at all, and just the UI control. Which would indeed be ideal!

                        EDIT: Actually, scratch that. I realised I did a dumb thing when testing - I was only turning the man DSPNetwork parameter. Not the actual UI control with the total_samples assigned to max. I can see it working fine now. So yeah, ultimately, the issue here all along (if you account for my being dumb!) was the 100,000 limit.

                        Think I'm all good now. I'll document some of these experiments in my Orv's Scriptnode thread for future reference!

                        1 Reply Last reply Reply Quote 0
                        • O Orvillain marked this topic as a question on
                        • O Orvillain has marked this topic as solved on
                        • First post
                          Last post

                        26

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        102.4k

                        Posts