How to make the "Range"

Hi. How can I make a node “Range”. It was in Audulus 2, but in Audulus 3 is gone. The Range clamps its input within a range specified by the min and max inputs.

1 Like

If I am understanding you correctly (which is possible I am not), I think what you are looking for the cross fade node with a knob, the minimum goes to A, the maximum to B, and the knob to C, which allows you to dial in any value in between. Let me know if this helps or if I am way off for your use case. :slightly_smiling_face:

1 Like

Use a clamp() expression. The syntax is clamp(a,b,c) whether a is the value to be clamped, b is the lower bound and c is the upper bound. clamp(x,0,1) clamps x between 0 and 1.

2 Likes

@stschoen I use clamp() quite a bit for limiting values, like when I am using the random node. It is a very useful expression.

When I think of range, I think of Python, as in:

for i in range(0,121):
    print(i)

Which is why I mentioned the cross fade node trick I learned from @robertsyrett Know Your Nodes series :slightly_smiling_face:

Your way is probably what he was looking for, now that I am re-reading the question and seeing your answer. My problem is that I have no context because I didn’t have A2 :wink:

2 Likes

Neither did I, but from the way his question was worded, I assumed he needed a way to limit a value. Most modern programming languages have some way to express a range. Swift has several.