A nice trick I don't see in the manual

You can do a lot more than simple arithmetic. VCV Rack uses TinyExpr - a parser and evaluation engine for mathematical expressions.

Here is an excerpt of the TinyExpr documentation that lists the operators and functions:

TinyExpr supports addition (+), subtraction/negation (-), multiplication (*), division (/), exponentiation (^) and modulus (%) with the normal operator precedence (the one exception being that exponentiation is evaluated left-to-right, but this can be changed - see below).

The following C math functions are also supported:

  • abs (calls to fabs), acos, asin, atan, atan2, ceil, cos, cosh, exp, floor, ln (calls to log), log (calls to log10 by default, see below), log10, pow, sin, sinh, sqrt, tan, tanh

The following functions are also built-in and provided by TinyExpr:

  • fac (factorials e.g. fac 5 == 120)
  • ncr (combinations e.g. ncr(6,2) == 15)
  • npr (permutations e.g. npr(6,2) == 30)

Also, the following constants are available:

  • pi, e

I haven’t been able to get e to work in VCV Rack, but pi does work.

VCV Rack configures log as natural logarithm rather than log base 10.

Unfortunately there is no log base 2. But that can be computed easily enough using any other log:

log2(x) = log(x)/log(2)
7 Likes