3
$\begingroup$

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.

$\endgroup$
2

1 Answer 1

5
$\begingroup$

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)
0.5

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

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

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?

Related

How to set driver distance max and min influence?

$\endgroup$
0

You must log in to answer this question.

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