Reference
Pattern literals
The s, n, notes, p and e literal macros, bare symbols as sample names, sub for subdivision, and the ($ expression) escape to ordinary Lisp.
Pattern literals are the short forms that turn sample names, numbers, pitches and other values into temporal patterns. They are Common Lisp macros, so they sit inside ordinary Lisp code and can return to it when a value needs computing.
The literal forms are macros with context-sensitive coercion: the same written token can be read differently depending on which literal contains it.
| Form | Primary purpose |
|---|---|
s | Sound/sample names and their mini notation. |
n | The legacy numeric/sample-index lane; its interpretation depends on the receiving context. |
notes | Explicit absolute pitches, including named and fractional pitches. |
p | Generic temporal values. |
e | Compact Euclidean construction. |
The string syntax that s accepts is described in Mini notation, which also includes an e example. Named pitches, scales and tuning are covered in Pitch, harmony, and tuning.
Inside s, bare symbols can mean sample names:
(d1! (s bd sn hh cp))Mini notation subdivides a slot with brackets inside a string. sub subdivides a slot directly in s-expressions:
(d1! (s bd (sub hh hh) sn (sub hh cp)))Here the second slot is divided between two hh events, and the fourth between hh and cp.
Use ($ expression) when a literal should evaluate ordinary Lisp:
(defparameter *kit* '("bd" "hh" "sn" "hh"))
(d1! (s ($ (apply #'cat *kit*))))*kit* is an ordinary Lisp list of strings. Inside the s literal, $ evaluates (apply #'cat *kit*), which passes those strings to cat, the subdivided-succession operation listed under composition operations.
Common Lisp functions, variables and control structures remain available. A list is ordinary Lisp data unless it is explicitly turned into a pattern. See Common Lisp and CLOS for why the surrounding language matters.
Source references
Repository-relative paths in the Mora source where these mechanisms are implemented.
-
src/mini/