Reference
Pipelines and composition
Threading a pattern through steps with >>, combining patterns with stack, cat, time-cat, arrange, align and merge-left, and routing source channels to output orbits.
Mora composes patterns in two directions: along a pipeline, where >> threads one pattern through transformations and clauses, and across time and voices, where operations such as stack, cat and arrange combine several patterns. This page also separates a channel’s source pattern from the SuperDirt orbits its events are sent to.
>> threads a pattern through transformations and clauses from left to right:
(d1! (>> (s "bd hh sn hh")
(fast 2)
(gain 0.8)))Construction and composition go through open protocols, including apply-transform, normalize-clause, apply-clause and pattern-merge-style. Some construction objects are transient. Extending Mora covers defining new transformations.
The same operator also threads visual operators, under defined ordering rules; see Shader composition.
A bang form also accepts consecutive steps after the pattern:
(d1! (s "bd hh sn hh")
(fast 2)
(gain 0.8))Use stack for simultaneous voices:
(d1! (stack
(>> (s "bd ~ bd ~")
(cut 1))
(>> (s "~ sn ~ sn")
(cut 2))
(>> (s "hh*8")
(cut 3))))Combining layers is a different operation from stacking voices:
- An ordinary pattern layer can combine values through
align. - Parameter annotations use
merge-left, so each existing event keeps its multiplicity while receiving its parameter.
The open pattern-merge-style protocol selects that behavior.
Useful temporal composition forms include:
| Operation | Purpose |
|---|---|
stack, overlay | Parallel patterns. |
cat, fast-cat | Subdivided succession. |
slow-cat | Succession across cycles. |
time-cat | Fit phrases into proportional weighted spans. |
arrange | Allocate actual cycle durations to sections. |
align | Combine temporal value layers according to their spans. |
merge-left | Annotate existing events without turning sibling voices into one event. |
time-cat weights are proportions of a span. arrange allocates actual cycle durations to sections. Do not use time-cat weights as if they were arrange durations. Arrangement and transitions covers arrange and its section clocks.
A Mora channel owns a source pattern. A SuperDirt orbit is an audio output/effect bus. The lanes of one stack can use separate orbits:
(d1! (stack
(>> (s "bd ~ bd ~")
(orbit 0))
(>> (s "~ sn ~ sn")
(orbit 1))
(>> (s "hh*8")
(orbit 2))))Orbit indices are zero-based here. The receiver and DAW must already be configured for the requested buses.
Because a channel can send its events to several orbits, a channel is not a universal audio submix. The mixer forms level and xfade address each channel’s configured target orbit: they do not automatically discover and fade every overridden orbit inside an arbitrarily routed stack. A multi-orbit composition needs matching routing and mix ownership; see Arrangement and transitions and From pattern to audio.
Source references
Repository-relative paths in the Mora source where these mechanisms are implemented.
-
src/mini/transforms.lisp -
src/mini/clauses.lisp -
src/mini/d-bang-bangs.lisp -
src/core/combinators.lisp