yield / await (~d)). Offline events() is deterministic. Live backends are optional.
from torq.cues import (
CueSchedule, CueEvent, CueBackend,
StubBackend, MidoBackend, CompositeBackend, has_mido,
midi, dmx, ch, u, note, MidiCue, DmxCue,
)
Lane tags (|) — MIDI/DMX only
Channel / universe tagging sugar (not general handoff). Parenthesize with >>:
(midi.note(60) | midi.ch(1)) >> cues
(dmx.cue({1: 255}) | dmx.u(2)) >> cues
| Symbol | Meaning |
|---|---|
ch(n) / midi.ch(n) | MIDI channel lane 0–15 (MidiChannel) |
u(n) / dmx.u(n) | DMX universe lane (DmxUniverse) |
note / note_off / cc / program_change / pitch_bend / aftertouch / poly_aftertouch | Untagged MidiCue builders (also under midi.*) |
dmx.cue(channels) / dmx_cue(...) | Untagged DmxCue channel map |
CueSchedule
| Member | Meaning |
|---|---|
CueSchedule(clock=None, backend=None) | Stamp API; bind a clock or use the current one |
.note_on(ch, note, velocity=100) | MIDI note on (channel 0–15) |
.note_off(ch, note, velocity=0) | MIDI note off |
.cc(ch, controller, value) | Control change |
.program_change(ch, program) | Program change (0–127) |
.pitch_bend(ch, value) | Pitch bend (0–16383; center 8192) |
.aftertouch(ch, value) / .channel_pressure | Channel aftertouch (0–127) |
.poly_aftertouch(ch, note, value) / .polyphonic_aftertouch | Per-note aftertouch (0–127) |
.sysex(data) | SysEx payload without F0/F7; non-empty bytes or ints 0–255 |
.dmx(universe, channels) | DMX channel set (dict or pairs; ch 1–512, val 0–255) |
.events() | Offline list sorted by time, then insertion |
.to_midi(...) / .save_midi(path, …) | SMF via optional mido (skips DMX) |
.clear() | Drop recorded events |
Backends
| Symbol | Meaning |
|---|---|
StubBackend | Dry-run sink: sent log, active_notes(), last program/bend/aftertouch/poly/sysex, DMX frame / level / blackout |
MidoBackend | Optional live MIDI via mido |
CompositeBackend(*backends) | Fan-out to several sinks |
has_mido() | True when optional mido can be imported |
CueEvent | One stamped cue (kind, MIDI/DMX fields, index) |
Example
from torq import Clock, ms, spork
from torq.cues import CueSchedule, StubBackend, midi, ch
clock = Clock()
backend = StubBackend()
cues = CueSchedule(clock=clock, backend=backend)
def junnu_riff():
(midi.note(60, velocity=100) | ch(0)) >> cues
yield 200 * ms
cues.note_off(0, 60)
clock.spork(junnu_riff())
clock.run()
assert backend.sent # dry-run log