Reference
Channels, tempo, and transport
Assigning and replacing the live channels d1! through d8!, stopping a part or the session, scheduled replacement, and setting tempo in BPM or cycles per second.
A Mora session plays what its live channels hold, at a rate set by the transport. This page covers how to run the language examples, how d1! through d8! assign and replace channel contents, how to stop one part or the whole session, and how tempo relates cycle time to seconds.
The language examples use the public package:
(in-package :mora)Evaluate one top-level form at a time. Many examples deliberately replace the contents of a channel, so the language pages are not a startup file to load wholesale. In Mora Studio, Cmd+Return, or its configured Control equivalent, evaluates a form; see Keybindings and presentation. The example file examples/mora-framework-intro.mora works the same way: execute its forms individually.
From pattern to audio, SuperDirtMora companion and Stems and sample libraries describe these prerequisites.
Pure pattern queries can be performed without producing sound. A query asks a pattern which events fall in a span of cycle time; requesting those events does not itself send audio. See Patterns and time.
Forms that address hardware, services or installation are explicit actions. Read them before evaluating them.
(bpm 140)
(d1! (s "bd ~ sn ~"))
(d2! (s "hh*8")
:gain 0.8)d1! through d8! immediately assign their respective live channels. Re-evaluating a channel replaces that channel’s composition; assigning another channel adds another active part.
Editing the text of a form does not generally install the change. Evaluating it does, and the addressed material is replaced according to its assignment policy. Interactive Studio controls follow their own explicit policy; see Inline controls.
A channel owns a source pattern. It is not the same thing as a SuperDirt output orbit; see Source channels and output orbits. Channel forms can also carry visual and post-processing facets, described in Multimodal channel forms.
To stop one channel, assign an actual silent pattern:
(d2! (silence))Evaluating (d1!) on its own is not a stop command. Use hush when the intention is to silence the session rather than one part. Inspect the transport and backend controls before using stronger panic or recovery operations; When something is silent or blank walks through the layers to check.
Bang forms assign immediately. Non-bang assignment can instead schedule the change at a boundary. Here :when :next-cycle asks for the next cycle:
(d1 (s "bd hh sn hh")
:when :next-cycle)The transport separates cycle coordinates from physical seconds. A cycle is a musical coordinate, not intrinsically a second or a bar; the transport maps it to physical time using tempo and beats per cycle.
| Form | What it sets |
|---|---|
bpm, tempo | Musical tempo in beats per minute. |
set-cps | Global cycles per second. |
With four beats per cycle, these two forms express the same rate:
(bpm 140)
(set-cps 7/12)140 beats per minute is 7/3 beats per second, which at four beats per cycle is 7/12 cycles per second. The two forms express the same rate under that beats-per-cycle setting. Mora exposes BPM directly so that setting the tempo does not require making this conversion.
Source references
Repository-relative paths in the Mora source where these mechanisms are implemented.
-
src/mini/d-bang-bangs.lisp -
src/runtime/channel.lisp -
src/runtime/transport.lisp -
examples/mora-framework-intro.mora