Docs
Reference
Math

# Math

Basic utilities for performing mathematical operations over various input signals.

### el.in

Identity function, `f(x) = x`.

Can also be used for accepting an input signal from the audio driver, whereupon the `channel` prop will be used to decide which incoming signal channel will be passed forward.

This same feature can also be used for selecting one of N children, for example:

``el.in({channel: 2}, w, x, y, z); // Equivalent to `y```

#### Props

NameDefaultTypeDescription
channel0NumberSelects which input channel to forward

### el.sin

Computes the sin of the input signal. Expects exactly 1 child node.

None

### el.cos

Computes the cos of the input signal. Expects exactly 1 child node.

None

### el.tan

Computes the tan of the input signal. Expects exactly 1 child node.

None

### el.tanh

Computes the hyperbolic tan of the input signal. Expects exactly 1 child node.

None

### el.asinh

Computes the inverse hyperbolic sin of the input signal. Expects exactly 1 child node.

None

### el.ln

Computes the natural logarithm (log base `e`) of the input signal. Expects exactly 1 child node.

None

### el.log

Computes the log (base 10) of the input signal. Expects exactly 1 child node.

None

### el.log2

Computes the log (base 2) of the input signal. Expects exactly 1 child node.

None

### el.ceil

Computes the ceiling (rounding up to the nearest whole number) of the input signal. Expects exactly 1 child node.

None

### el.floor

Computes the floor (rounding down to the nearest whole number) of the input signal. Expects exactly 1 child node.

### el.round

Rounds the input signal to the nearest whole number. Expects exactly 1 child node.

None

### el.sqrt

Computes the square root of the input signal. Expects exactly 1 child node.

None

### el.exp

Computes `e^x` where x is the input signal, and `e` Euler's number. Expects exactly 1 child node.

None

### el.abs

Computes the absolute value of the input signal. Expects exactly 1 child node.

None

### el.eq

Compares the first input to the second input, returning 1 when the the two signals have equal values, and 0 otherwise.

None

### el.and

Compares the first input to the second input with a binary "and" operation. Returns 1 when the two signals both have a value of 1, and 0 otherwise.

None

### el.or

Compares the first input to the second input with a binary "or" operation. Returns 1 when either of the two signals has a value of 1, and 0 otherwise.

None

### el.le

Compares the first input to the second input, returning 1 when the first is less than the second, and 0 otherwise. Expects exactly 2 children.

None

### el.leq

Compares the first input to the second input, returning 1 when the first is less than or equal to the second, and 0 otherwise. Expects exactly 2 children.

None

### el.ge

Compares the first input to the second input, returning 1 when the first is greater than the second, and 0 otherwise. Expects exactly 2 children.

None

### el.geq

Compares the first input to the second input, returning 1 when the first is greater than or equal to the second, and 0 otherwise. Expects exactly 2 children.

None

### el.pow

Computes `a^b` where `a` is the first input signal and `b` is the second. Expects exactly 2 children.

None

### el.mod

Computes `a % b` where `a` is the first input signal and `b` is the second. Expects exactly 2 children.

None

### el.min

Computes `min(a, b)` where `a` is the first input signal and `b` is the second. Expects exactly 2 children.

None

### el.max

Computes `max(a, b)` where `a` is the first input signal and `b` is the second. Expects exactly 2 children.

#### Props

None

Performs a left fold over the available inputs with the add operation: `(((in1 + in2) + in3) + ...)`. Expects one or more children.

None

### el.sub

Performs a left fold over the available inputs with the subtract operation: `(((in1 - in2) - in3) - ...)`. Expects one or more children.

None

### el.mul

Performs a left fold over the available inputs with the multiply operation: `(((in1 * in2) * in3) * ...)`. Expects one or more children.

None

### el.div

Performs a left fold over the available inputs with the divide operation: `(((in1 / in2) / in3) / ...)`. Expects one or more children.

None