Math

UtilitymathLight CPU

Two inputs, one fixed operator: add, subtract, multiply, divide, min, max, or compare.

What it does

One fixed arithmetic or comparison operator over two signals — the general-purpose Utility tile.

Pure inline arithmetic — no DaisySP class, no state, nothing remembered between samples. A and B are bound to locals and the chosen operator is emitted as a single expression. Closes the Compare / Threshold gap: A > B is the threshold detector, with B wired from a knob or a Scale / Offset constant.

Parameters

  • Operator

    op
    Default add

    Which arithmetic runs on A and B, chosen at build time — it cannot be switched while the patch runs. ⚠ The operator also decides what the output MEANS. A + B, A − B, A × B and A ÷ B produce an unbounded float; Min and Max stay inside the range A and B span; A > B and A < B produce a gate that is exactly 1.0 or 0.0 and nothing in between. Wire a comparison into a trigger or an envelope gate, not into something expecting a continuous control. A ÷ B with B at (or within 1e-6 of) zero emits 0.0 rather than infinity, so a wrong patch stays audible instead of collapsing into NaN.

Out = A + B. Out is unbounded — whatever the sum produces. Nothing is clamped. An unwired input reads 0.0 — so with B unwired, A + B passes A through and A × B emits silence.

Shown for the default parameters — this changes with them.

Ports

In

  • A a
  • B b

Out

  • Out output

Audio Control

Inputs

A
Left operand. Unwired reads 0.0.
B
Right operand — wire a knob or a constant here to compare against. Unwired reads 0.0.

Outputs

Out
The operator applied to A and B. ⚠ Its range depends on which operator: unbounded for arithmetic, bounded by the inputs for Min/Max, and a 1.0/0.0 gate for the comparisons.

Rules and gotchas

  • ⚠ The output type is NOT uniform across operators. The four arithmetic ops and Min/Max emit a continuous value; > and < emit a gate that is only ever 1.0 or 0.0. Check which one you picked before wiring the output.
  • The operator is baked at build time — it cannot be modulated. Chain a Crossfade between two Math tiles if you need to switch behaviour at runtime.
  • Division guards against zero: |B| < 1e-6 emits 0.0 rather than infinity, so an unwired or decayed B cannot push NaN into the rest of the graph.
  • No clamping anywhere else — the arithmetic ops produce whatever they produce, exactly like Scale / Offset.

Patches using it

  • Comb Filter (Feedback Loop)standard
  • Math - Compare and Gatepatch_sm

Bundled with the app — open one from the example browser.