Skip to content

Perform

Perform turns the compiled song into a live instrument without moving musical authority out of TypeScript.

Play, pause, stop, and seek operate on the runtime’s single transport state. The arrangement follows song.arrange(...); the same bar clock drives visual playheads, section capture, MIDI, recording, automation, telemetry, and remote commands.

In Session, sections are scenes. Launching a section queues it to the next bar while playing and loops it in place; clearing the scene returns to the linear arrangement. Scene launch changes runtime state, not source.

Flags bind pads, CCs, toggles, latches, or constants to named values read by section code. The controller changes the performance while the program remains readable:

song.flag("ratchet", { kind: "pad", note: 36, mode: "latchBar" });
song.section("drop", bars(8), (t) => {
hats.play(t.flags.ratchet ? r`x*16` : r`. x . x`);
});

Flag updates are quantized through the same capture-and-commit model as local controls and MCP transport commands.

Track faders, pan, mute, solo, return levels, and master level are live runtime state. The Mixer and MCP get_mixer / set_mixer tools read and change the same values. Source automation remains a separate stage, so a manual performance ride does not rewrite composition code.

Web MIDI supports:

  • note input and source-backed MIDI capture;
  • MIDI output tracks for external instruments;
  • MIDI Clock leader and follower modes;
  • Start, Continue, Stop, and Song Position Pointer;
  • BPM, jitter, drift, port, pulse, and sync-error diagnostics.

Follower mode gives the external clock transport authority and stops local free-running playback. Losing the source or audible-tab ownership fails closed.

An external output declares portable intent: MIDI port/channel, logical return name, and optional fixed hardware latency. Audio Setup maps the logical return to a physical input and measured round trip. Record can print that return into a managed source-backed take; export requires a print or freeze rather than silently rendering missing hardware as audio.

The MCP transport tool can play, pause, stop, seek, set flags, set/clear loops, launch scenes, and toggle the metronome. Mixer tools expose live balance, and get_status reports playhead, per-track levels, Audio Session health, I/O, PDC, and MIDI sync. These commands need an open Studio tab because the browser owns the live engine.