> ## Documentation Index
> Fetch the complete documentation index at: https://torqpy.itsdote.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Domains on one clock

> How audio, MIDI/DMX, sim, and lab share torq.py’s logical timeline.

torq.py is **timing-first**. Domains are entry points onto the same rational `Time` / `Dur` clock — not separate runtimes.

| Domain | Entry points | Highlights |
| - | - | - |
| **Core clock / shreds** | `Clock`, `Time`, `Dur`, `spork`, `yield` / `await (~d)` | Exact rational time; concurrent shreds in ordinary Python |
| **Ergonomics** | `with clock:`, `now`, `wait`, `~d`, `t ^ d`, `Pat` / `p["x-x-"]`, `@shred` | Context-local clock; patterns; unary `+` spork |
| **Shared values / events** | `Shared` / `clock.shared()` | Thin typed keys + emit/once (not a PySim capacity Store) |
| **Shared patching** | `Flow`, `Node`, `Bound`; `>>`, `@` / `.on`, `.to`, `.send` | Clock/engine bind + handoff/fan-out |
| **Audio / synth** | `torq.audio.AudioEngine` | In-process UGens + embedded STK on torq.py’s sample clock |
| **MIDI / DMX cues** | `torq.cues.CueSchedule`; `\|` lane tags | Deterministic stamps; SMF export; stub / mido / composite sinks |
| **Sim ticks** | `SimClock(dt)` | Fixed `step` / accumulator `frame`; `%` grid quantize |
| **Lab protocols** | `torq.lab.Protocol` / `Session`; `sensor` / `metric` | Stimuli, DAQ windows, shuffle / ISI jitter, CSV/JSON |

## Cross-domain coordination

Use `Shared` for latest-wins values and one-shot events; use patching operators to bind and route; keep shreds as the process model.

```python theme={null}
from torq import Clock, Shared, Node, ms, spork

clock = Clock()
bus = clock.shared()
kick = Node("kick")

def junnu():
    yield 50 * ms
    bus.set("ready", True)
    bus.emit("hit")

def laddu():
    yield from bus.wait("ready")
    kick.to(Node("out"))

clock.spork(junnu())
clock.spork(laddu())
clock.run()
```

## Design notes in-repo

The repository still keeps longer design writeups as Markdown under `docs/` (for example `strongly-timed-python.md`, `torq-sim.md`). The Mintlify site is the curated API surface.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.