An ongoing source of amusement for me with VCV Rack is that I quite often know how to do something specific with control values in SuperCollider or Pure Data, but I can’t find the corresponding analog-style module.
Example: I’m getting accelerometer data from my phone, massaging them in Pd (because converting the raw data into angles of rotation requires functions like arcsin, pretty sure there’s no module for that) and then sending MIDI over to Rack. 0 = 90 degrees rotation in one direction, 127 = 90 degrees in the other. 64 = neutral. In voltages, that’s +5V = neutral, +0 = 90 one way, +10 = 90 the other way.
Now I want to use part of the range along one axis to increase a filter frequency – that is, I want to use +5 - +10V, but I want to clip off the lower part of the range.
In SC/Pd, this is stupidly simple: max(controlVoltage, 5) and bang, everything below 5 is clipped off, everything above is untouched.
In Rack, I can find e.g. Bogaudio CLPR which… assumes a symmetric range about 0. There’s no independent control over upper and lower bounds. I suppose I can use multiple offsets (e.g. 0-10 range offset to -10 to 0, then clip -5 to +5 leaving -5 to 0, then offset back up)… but… like, really?
Is there a cookbook anywhere of these really-really-simple math operations that are not so simple in modules? People must have solved these problems.
(I use Rack with students… these particular students don’t get into programming at all, but some of them will approach Rack.)
Thanks, all. Any and all of the above would do it.
I guess it’s a terminology thing – I did search for “max” but only found modules that would report min/max values. “Clamp” would have been a better search term but this term isn’t used in the programming environments I use (it’s clip or min or max), so I hadn’t guessed it.
As the previous responses show, there are lots of options. Here are some more:
For general, arbitrarily complex math, the new docB Formula One module offers better performance (lower CPU), more inputs (5), more controls (5), and more outputs (3), then the Frank Buss Formula.
The best performing general math utilities I have found are the Submarine A0-XXX series (arithmetic operators). They do not have as many functions as Formula or Formula One, but there are still a great many. It can be a bit confusing to work with though. But of particular interest is the diminutive A0-101 that allows you to do a single math operation, including min or max, or trig functions, only using 2hp.
There are additional dedicated min/max modules, including
and of course the jack of all trades, Rampage, with its Min and Max outputs