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

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

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:

FamilyOperations
Arithmeticp+, p-, p*, p/
Roundingp-round, p-floor, p-ceil
Range mappingIncluding rangex and the signal-specific range helpers

A signal driving pitch

Common Lisp
(d1! (>> (notes ($ (p+ 48 (p* 12 (segment 8 (tri))))))
         (s "psin")))

Read the expression from the inside out:

  • (segment 8 (tri)) samples the tri signal into an event grid.
  • As the patterned forms of multiplication and addition, p* scales the sampled values by 12 and p+ adds 48. In Mora’s named-pitch convention, MIDI 48 is C3; see absolute pitches.
  • ($ ...) evaluates that ordinary Lisp expression inside the notes literal. See pattern literals for the $ escape.
  • (s "psin") selects the instrument.

Signals are temporal data

For other ways to reshape patterns over time, see transformations and groove.

Documentation

Search the documentation

Results update as you type. Use the up and down arrow keys to choose a result and Enter to open it.