I have a driver using a scripted expression: var*2. It's working great but the values it's outputting range from .005 up to about 1.5. I'd like to limit the range of the output to something like a minimum of .5 to a maximum of 1.25. Is it possible to do this within the expression itself?

Edit: A little more information, I'm trying to use a sound file to drive a particle value. "Bake Sound to F-Curves" provides me with a non editable F-curve so I'm trying to use a driver to increase the amplitude of the baked F-Curve.

  • $\begingroup$ Related blender.stackexchange.com/questions/39231/… $\endgroup$
    – batFINGER
    Commented Mar 2, 2019 at 5:46
  • $\begingroup$ Thanks, I had looked over that. I'm just wondering if there's a simple expression that can be written that sets a min and max value. $\endgroup$
    – Ironlion
    Commented Mar 2, 2019 at 6:21

1 Answer 1


Min max

Use the expression min(max(v, 0.5), 1.25) or its dual max(0.5, min(v, 1.25)) where v is the driver variable (sound curve value)

>>> v = 0.05
>>> min(max(v, 0.5), 1.25)

>>> v = 3
>>> min(max(v, 0.5), 1.25)

>>> v = 1.1
>>> min(max(v, 0.5), 1.25)

If you wish to double the variable v simply replace v with 2 * v in expression.

I would recommend you normalize the values in some way What's the range of values on a sound-baked f-curve?


How to set driver distance max and min influence?


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .