Trying to clamp a number, I saw Ruby has a useful
Comparable#clamp method to do common
myFloat.clamp(0,1). type stuff
but in sonic Pi it broke with: " wrong number of arguments (given 2, expected 1)"
After some digging around I found this release note:
Numeric#clamp- max and minimum bound (will clamp self to a value <= other and >= -1*other.`
So I assume this hides the builtin `clamp.
[-x, x] binding range can be useful, its hardly the only usage for clamp (I tend to clamp on
[0,1] a lot, but sometimes arbitrary values as well).
Is there a way to use the ruby builtin clamp method?
P.S. - On a side note, is there an API reference for all custom functions?
I know about the tutorial (Which is awesome!), but it doesn’t cover the finer details of function discoverability and usage, which often stump me as a developer new to Sonic Pi.
Even just a list of functions with param type expectations would help a bunch.