Custom transfer curve for knobs/sliders on the macro page using a LUA script?

Hi

I’m not sure if I chose the right title for this thread, but I’ll explain: I want to control a parameter with a knob on the MacroPage in a non-linear (custom) fashion. Case in point: I need to place a knob on the MacroPage and assign it to the Level Velocity parameter (Vel>Lev) of several sample sets that are placed in several sub-layers. This part is easy to do but the problem is that the Level Velocity parameter goes from -200% to 200% and I don’t need all that range. I want to use only the 0% to 100% range, and I also want the relation knob>parameter to be in reverse, meaning that when the knob is rotated from min to max (clockwise), the Level Velocity parameter should go from 100% to 0% (anticlockwise), like in this image:

Any suggestions for a script that could accomplish this?

Cheers!

Create a script parameter with the desired range and from its callback set the Level Velocity parameter of all zones. If you want to invert the range just do some simple math 100 - parameterValue before setting the parameter.

1 Like

Thank you @misohoza !

I managed to come up with this little script:

vs = this.parent:findZones(true)
 

 function setVeloSens() 
      newvalue = 100 - VSknob
      for i, zone in ipairs(vs) do
             zone:setParameter(327710, newvalue)
      end
 end

defineParameter("VSknob", nil, 0, 0, 100, 1, setVeloSens)

And it seems to work just fine.

1 Like