Reference
Signals and patterned arithmetic
Continuous signals, segment sampling, and named patterned arithmetic that works alongside Common Lisp's ordinary arithmetic.
Continuous signals supply changing values to patterns, and patterned arithmetic combines and reshapes those values. This page lists both families and explains how they differ from ordinary Lisp arithmetic and from audio-rate modulation.
Continuous signals such as sine, cosine, saw, tri, perlin, and rand-signal can supply changing values to a pattern.
segment samples a signal into a finer event grid.
Patterned arithmetic has explicit names, so it does not replace Common Lisp’s ordinary arithmetic. The Lisp operators keep their usual meaning, and the patterned forms are named separately:
| Family | Operations |
|---|---|
| Arithmetic | p+, p-, p*, p/ |
| Rounding | p-round, p-floor, p-ceil |
| Range mapping | Including rangex and the signal-specific range helpers |
(d1! (>> (notes ($ (p+ 48 (p* 12 (segment 8 (tri))))))
(s "psin")))Read the expression from the inside out:
(segment 8 (tri))samples thetrisignal into an event grid.- As the patterned forms of multiplication and addition,
p*scales the sampled values by 12 andp+adds 48. In Mora’s named-pitch convention, MIDI 48 is C3; see absolute pitches. ($ ...)evaluates that ordinary Lisp expression inside thenotesliteral. See pattern literals for the$escape.(s "psin")selects the instrument.
For other ways to reshape patterns over time, see transformations and groove.