HISE Logo Forum
    • Categories
    • Register
    • Login

    about an equation?

    Scheduled Pinned Locked Moved General Questions
    4 Posts 3 Posters 209 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

      hello everyone

      with my Knob (x value), I need to get the below corresponding y values. It is not linear :/ How can I implement it?

      x vs y
      0.0 -10.0
      1.0 -2.9
      2.0 -1.15
      10.0 1.04
      100 2.01

      d.healeyD orangeO 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @A Former User
        last edited by

        @Steve-Mohican

        If you only need those values the simplest way would be to use two arrays

        inline function onKnob1Control(component, value)
        {
        	local input = [0.0, 1.0, 2.0, 10.0, 100.0];
        	local output = [-10, 2.9, -1.15, 1.04, 2.01];
        	
        	if (input.contains(value))
        		Console.print(output[input.indexOf(value)]);
        };
        
        Content.getComponent("Knob1").setControlCallback(onKnob1Control);
        

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

        ? 1 Reply Last reply Reply Quote 1
        • orangeO
          orange @A Former User
          last edited by orange

          @Steve-Mohican

          If you want the values' transition each other, yes you definitely need a non linear equation for this situation. You can get very close values with a rational equation which is essentially this: (a+b*x)/(1 + c*x + d*x^2)

          Here you go :grinning_face_with_big_eyes:

          HiseSnippet 992.3ocsV0saaaCElxIJaVasXcnO.BE6B60FGIaK+CJJpWbbJL5RpQcpQ2UELRTwDlhTShpstE8t87r2o8Fr2fsCojiUVLbaMvDfAz4W9c9z4bnmjH7IoohDjQ0KVFSPFeu4zkb47gywTNZ7IHi6ZdFNURRryUc7xXbZJI.YXr2yTJLptOR+72O8XLCy8IqUgPyDTexuRinx0ZmL34TF6Tb.4BZTIuaOXrufOTvDY.d1yzAEi8WfuhbNV4VESjwAiBnRQxTIVRRAeNVDrb5bw6349OilRujQTBtnoPhxUiFNmxBlrpVSQHi8mrtx2Kuxuu4Yz.505Wy.+f1f85HJyAFU1Fjb+JfjQIHseNjtm4T+DZrbsEEd9Nywb3CRHFn5xPI2WTkiqXNT.dvkMhvKHml.BWGQsVNNOxtoiS8GaYYA7cpz9s3D6myEW5Z+D6UQdEQNTDEK3fPsGns9.UHTNixI1gYbeIUvsEbsMUXIBVM+Uw7HHqrLRcqOZU8nireIV4MlYO52yzuZaUkI7AE9BRX3L3kmXWq1gtMbTOM852qe21caM5gNt0seHXpYiNc560saSOmtdc60p9Ome.0sOxtlq1E2Fdsb5zrcyNc6302o2JWzFOrYCOudM621qe2NNs8bGcnCjjyvx4MhEuql1UfYpWu9iAvYUEJoTAizHNgBTvJXp3fOA+1JO0HUoUyHCwL1kPabsaRTZ12pDKdtPRdAullur9jk8+0TX3FsUjNFIYilUCXIaKvZ7rnKIIk+ZobD5.uYa8AeYs094rRIGE7wbp7EwjB4SEr.U6p58aODfJnU03PABAWk5gg6VLLLkQCHIHJjjuwTyoHM3WuH4mFfd03SvR7pz.YDNkXRhjpJFiSHuEVKkOiU07DR5BoHV6awWRjwc9rG56WefyFrbsv4CRkKUTyAZGQQzf.FYhHkpn9xnDVqFOk9AMx+38+ym8We3OdZT4UpHTDtzw7aCRyBCouWuKLjxhRk.1FGAqHQF+n4qRI1AjPbFSZmt.xCLotfDbgP6egkY2hpt8ZGXgmHHigk2bKnZcegAUgTd0iZ8BGJvkkuN3qX0nyVWM9kBw6YNgJ8muYLVYCXD5O9+.iEWnbGyQggDe4Z.tu4oudWu83yb7uTjIo7qf0YIpFDyyyhlB2i5SfSmyILH4lFUTSX4xNJYECLkvCzB+C7TXzUIaTXzckQnYzOQ7F+74R0UVeqVCfIt9F5pveU.jsudfzzzogiZ.f9FeeU4enKBs4XZtCwzZGho8NDi2NDSmcHlt6PL81ZLp+3xujIEQ4iCfhIizKFMLFwwPmktKD8uXb+vpC
          

          develop Branch / XCode 13.1
          macOS Monterey / M1 Max

          1 Reply Last reply Reply Quote 2
          • ?
            A Former User @d.healey
            last edited by

            @d-healey @orange thank you so much guys! both 2 ways are great for using, I really appreciate your help. do I have to know the math for these stuff? ahahah :grinning_face_with_sweat:

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

            47

            Online

            1.7k

            Users

            11.7k

            Topics

            101.8k

            Posts