These are the primitive per-channel operations on signals, defined in
synthdef.x. All are elementwise across channels with broadcasting
(§2.4).
| Group | Operations |
|---|---|
| Prefix operators | -a (negate), !a (logical not), ~a (bitwise not) |
| Basic | abs, sign |
| Rounding | floor, ceil, trunc, round |
| Roots | sqrt, cbrt |
| Logarithms | log, log2, log10, log1p |
| Exponentials | exp, exp2, exp10, expm1 |
| Trigonometric | sin, cos, tan, asin, acos, atan |
| Hyperbolic | sinh, cosh, tanh, asinh, acosh, atanh |
| π-scaled trig | sinpi, cospi, tanpi — sinpi(x) = sin(πx); cheaper and exact at integer arguments |
| Special | lgamma, tgamma, erf, erfc |
| Bit counting | clz, ctz, clo, cto, popCount, bitWidth, hasSingleBit |
| Bit shaping | rotr, rtol (rotate left), bitCeil, bitFloor |
| Group | Operations |
|---|---|
| Arithmetic | + - * / // (integer divide) % (mod) |
| Bitwise | & | ^ << >> >>> (unsigned shift right) |
| Named math | min, max, pow, atan2, hypot, copysign |
| Pipeline aliases | add, sub, mul, div, mod — the arithmetic operators as named
functions, for space-pipeline style: x mul(0.5) add(1) |
< <= == != >=
> compare per channel and produce a numeric 0/1 signal, not
a Bool. This is the idiomatic building block for gates and masks — multiply by a
comparison to zero out a signal, or feed one to select2:
(x > 0) -- 1 where positive, else 0
x * (phase < pwm) -- gate x by a pulse
urand() < prob -- Bernoulli trigger (see coin)
i32, i64, f32, f64 force the element
type (§2.2). They accept any AsSignal.