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.

Running the examples

The language examples use the public package:

Common Lisp
(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.

What sound-bearing examples need

From pattern to audio, SuperDirtMora companion and Stems and sample libraries describe these prerequisites.

Queries without sound

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.

Assigning live channels

Common Lisp
(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.

Stopping a channel or the session

To stop one channel, assign an actual silent pattern:

Common Lisp
(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.

Scheduling a replacement at a boundary

Bang forms assign immediately. Non-bang assignment can instead schedule the change at a boundary. Here :when :next-cycle asks for the next cycle:

Common Lisp
(d1 (s "bd hh sn hh")
    :when :next-cycle)

Tempo and cycle rate

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.

FormWhat it sets
bpm, tempoMusical tempo in beats per minute.
set-cpsGlobal cycles per second.

With four beats per cycle, these two forms express the same rate:

Common Lisp
(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

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.