Forum
    • Categories
    • Register
    • Login

    XY Pad Gain Scaling...

    Scheduled Pinned Locked Moved Solved Scripting
    2 Posts 1 Posters 37 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.
    • J
      JamesC
      last edited by

      Morning all hope you are all enjoying the holidays still.

      I've got an XY Pad in a project that in itself is working nicely doing what it should and has a knob assigned to X axis and one to Y axis as you would expect, I'm wanting to control the gain on 4 simple gains 2 on the X 2 on the Y which again I've got working as it should, I'm just not sure to the maths for the values currently I've got it set to this:

      inline function onxypadControl(component, value)
      {
      	local x = component.data.x;
      	local y = component.data.y;
      	
      	gains1[0].setAttribute(gains1[0].GainValue, 36 * x);
      	gains1[1].setAttribute(gains1[1].GainValue, 36 - 36 * y);
      	
      	gains2[0].setAttribute(gains2[0].GainValue, 36 * x);
      	gains2[1].setAttribute(gains2[1].GainValue, 36 - 36 * y);
      	
      	knbxy[0].setValue(x);
      	knbxy[1].setValue(y);
      	
      	component.repaint();
      	
      }
      

      Which works to set the gain between 0 and 36. Now 36db is going to be way too loud for whats going on here so yes I could reduce that but also gain running right down to -100 whats the easiest way for me be able to include some of that in the range essentially looking at -30 to 20 or some such or in other words almost barely noticeable to packs some punch if you want.

      J 1 Reply Last reply Reply Quote 0
      • J JamesC has marked this topic as solved
      • J
        JamesC @JamesC
        last edited by

        @JamesC So for those interested this is how I solved it in the end with a bit of AI help:

        inline function onxypadControl(component, value)
        {
        	local x = component.data.x;
        	local y = component.data.y;
        	
        	local gainX = -40 + (60 * x);
        	local gainY = -40 + (60 * (1 - y));
        	
        	gains1[0].setAttribute(gains1[0].GainValue, gainX);
        	gains1[1].setAttribute(gains1[1].GainValue, gainY);
        	
        	gains2[0].setAttribute(gains2[0].GainValue, gainX);
        	gains2[1].setAttribute(gains2[1].GainValue, gainY);
        	
        	knbxy[0].setValue(x);
        	knbxy[1].setValue(y);
        	
        	component.repaint();
        	
        }
        
        1 Reply Last reply Reply Quote 1
        • First post
          Last post

        23

        Online

        2.1k

        Users

        13.1k

        Topics

        113.8k

        Posts