open-audiovisual
Search GitHub

Documentation

Package reference#

Chapter 20 of 24Source: docs/packages.md

Thirty-four packages live in packages/<name>/. Each is plain ES modules with no dependencies; in a page you import them as @openav/<name> through an import map (copy the one in examples/01-hello-particles/index.html). Nothing is on npm yet.

layerpackages
L1 inputmidi · audio · chord · pose · leap · keys · drums
L2 mappingmapping · chop
L3 worldstage · world-webtoe
L4 outputsound · osc · out · dmx · output · align · record · fab · hw (and MIDI out in midi)
spinestimeline · score · pattern · console · monitor · sync
phonesrelay · surface · remote · tile
gluecore · show · devices · mcp

Subpath entries (@openav/remote/host, @openav/relay/server, @openav/surface/layout, @openav/surface/auto) need their own import-map line in a browser, for example "@openav/remote/host": "../../packages/remote/host.js?v=e516f9f76".

@openav/core#

Glue · the shared language: Signals, Params, Loop, Bus.

exportsignature
Signalsnew Signals() · define(name, { kind, min, max, unit, description, source }) · set(name, value) · pulse(name, payload = 1) · get(name) · norm(name) → 0..1 · on(name, cb(value, name)) → unsubscribe · onAny(cb(name, value, meta)) → unsubscribe · list() → [{ name, value, at, kind, min, max, … }]
Paramsnew Params(schema = []) · add(entries) · get(key) · clamp(key, v) · override(key, v) · clearOverride(key) · clearAllOverrides() · isOverridden(key) · firePulse(key) · onPulse(key, cb) → unsubscribe · resolve(base) → state · schema, overrides
Loopnew Loop(onFrame(dt, now), { maxDt = 0.1, clock, raf, manual = false, heartbeat }) · start() · stop() · step(dt) → boolean (one frame of dt seconds, unclamped) · fps, running, manual. clock() → ms (default performance.now), raf(cb) → the next frame (default requestAnimationFrame); an injected raf or manual turns the hidden-tab Worker off (heartbeat: true turns it on). See Driving the frames yourself
Busnew Bus() · on(event, cb) → unsubscribe · off(event, cb) · emit(event, payload)
js
import { Signals, Params, Loop } from '@openav/core';
const signals = new Signals();
signals.define('breath/pressure', { min: 0, max: 1 });
signals.on('breath/pressure', (v) => console.log(v));
signals.set('breath/pressure', 0.4);

@openav/show#

Glue · createShow(options): one call that assembles a whole show around a world and returns every part. Options, modules and the return value are in Show control; loop, monitor and console (the desk's keys) choose who drives the frames, where the backstage feed goes and which keys run the desk; sync makes the page one of several that perform the same show (leader or follower, @openav/sync). The same page at ?output is a clean output: the stage alone on black, no desk (@openav/output).

js
import { createShow } from '@openav/show';
const show = await createShow({ world, modules: { keys: { base: 48 }, sound: true } });

@openav/midi#

L1 input and L4 output · Web MIDI in and out, many devices at once, and on-screen controllers that mirror real hardware.

exportsignature
Midinew Midi({ signals, filterOut = 'IAC', requestAccess, echoWindow = 40, prefer = [] }) · enable(preferredOut = '') → Promise<boolean> · devices() → [{ slug, name, listening }] · setListening(slug, on) · onDevices(fn) · onOutput(fn({ text, reason, next })) · listen(fn(bytes, port)) · selectOutput(name) → boolean (and remembered as your choice) · outputFor(nameOrRegExp) · send(bytes) · noteOn(note, vel = 100, ch = 1) · noteOff(note, ch = 1) · cc(cc, val, ch = 1) · panic() · dispose() · hooks onCC, onNote, onMessage, onSend, onDeviceChange · out, outputs, preferredOut, echoDropped
output hot-plug, echopickOutput(outputs, { preferred, prefer }) · reselectOutput({ current, outputs, preferred, prefer }) → { next, changed, reason, text } · EchoGuard({ window }) (sent(bytes), isEcho(bytes)): the pure logic behind Midi, see Show control
score to MIDInew ScoreMidi({ midi, channel = 15, segment = { note: 36 }, cue = { note: 84 }, length, scrub, enabled }) · segment({ index, cause }) · cue({ name, n }): segment changes and cues as notes and CCs, see Score & Director
parsingparseMessage(bytes) → event · encodeMessage(event) → bytes · genericSignals(event, { device }) · publish(signals, list) · describe(event) · relativeDelta(value, mode), relativeValue(delta, mode), RELATIVE_MODES · bendToUnit, unitToBend, BEND_CENTER
controllersMidiController, MidiControllers, controllerRoutes(profile, bindings), PROFILES, profileById(id), ControllerView, mountMidiPanel(el, controllers, opts), linkControllers, profile helpers (validateProfile, normalizeProfile, matchProfile, …)
Web MIDI shimcreateVirtualMIDIAccess({ name, onOutput(bytes, timestamp), onClear }), virtualRequestMIDIAccess, splitMidi(bytes): its output is heard with each send's timestamp
MidiClock (clock.js)new MidiClock({ ppq = 24, beatsPerBar = 4 }) · feed(bytes, t) → 'clock'·'start'·'continue'·'stop'·'spp'·'dupe' · bpm · phaseAt(t) → { pos, bar, beat, bpm, running } · anchor() · state(t): follow an external MIDI clock (With Strudel)
embeddingcreateController(profile, { profiles, signals, channel, follow, midi, requestAccess, filterOut, telemetry }) → ControllerHost (on(event, fn), set, press, release, values, mount(el), learn(), dispose()) · loadProfile(idOrUrl) · the <oav-controller> element in packages/midi/element.js · embed protocol helpers in embed.js
js
import { Midi } from '@openav/midi';
const midi = new Midi({ signals });
await midi.enable();
midi.noteOn(60, 100, 1);

Signals: Signals reference. Controllers, profiles and the shim: MIDI controllers & embedding.

@openav/audio#

L1 input · microphone (or any audio node) analysis.

exportsignature
AudioAnalyzernew AudioAnalyzer({ signals, fftSize = 2048, smooth = 0.7 }) · enableMic() · enableElement(mediaEl) · input() → an AnalyserNode to connect into · update() per frame → { rms, peak, low, mid, high, centroid, onset, kick, snare, hat }
js
import { AudioAnalyzer } from '@openav/audio';
const audio = new AudioAnalyzer({ signals });
await audio.enableMic();          // from a click
// every frame: audio.update();

@openav/chord#

L1 input (an analyzer) · groups struck notes into gestures and publishes consonance, triads and clusters.

exportsignature
ChordDetectornew ChordDetector({ window = 80, onChord, signals }) · noteOn(note, vel = 0.8) · noteOff(note) · analyze(notes, vels) → analysis (pure)
js
import { ChordDetector } from '@openav/chord';
const chord = new ChordDetector({ signals });
signals.on('midi/note/on', ({ note, vel }) => chord.noteOn(note, vel));
signals.on('midi/note/off', ({ note }) => chord.noteOff(note));
chord.analyze([60, 64, 67]).chordType;   // 'major'

@openav/pose#

L1 input · body and hand tracking from the camera with MediaPipe, on the device.

exportsignature
PoseTrackernew PoseTracker({ signals, mirror = true }) · enable({ videoEl }) (from a click) · stop() · skeleton(ctx, w, h, { color, lineWidth }) · landmarks, running
HandTrackernew HandTracker({ signals, mirror = true }) · enable({ videoEl }) · stop() · skeleton(ctx, w, h, { colorLeft, colorRight, lineWidth }) · hands, running
js
import { HandTracker } from '@openav/pose';
const hands = new HandTracker({ signals });
button.onclick = () => hands.enable();

@openav/leap#

L1 input · Leap Motion / Ultraleap hands through the machine's bridge (node packages/leap/bridge/leap-bridge.mjs, ws://127.0.0.1:6437). The same bridge speaks the old LeapJS protocol, so 2014–2021 leap.js sketches run unchanged.

exportsignature
LeapInputnew LeapInput({ signals, url, reconnect = true, fingers = true, box, thresholds }) · connect() · disconnect() · simulate({ target }) → stop() · skeleton(ctx, w, h, { view, colorLeft, colorRight, lineWidth }) · mountPanel(el) · onFrame(fn) · onStatus(fn) · ingest(msg) · hands, frame, status, device
framesV6Converter (raw → LeapJS v6) · handsOf(msg) · normalizePoint(p, box) · handAngles(direction, normal) · mockHand(o) · mockFrame(t)
gesturesHandGestures · Hysteresis(on, off) · THRESHOLDS (pinch 0.86 / 0.5, both hands 0.8 / 0.5, grab 0.8 / 0.5)
js
import { LeapInput } from '@openav/leap';
const leap = new LeapInput({ signals }).connect();   // ws://127.0.0.1:6437/v6.json
leap.onFrame(() => leap.skeleton(ctx, w, h));          // joints in mm: leap.hands
// no sensor: leap.simulate() — mouse = right palm, press = pinch

@openav/keys#

L1 input · the on-screen piano, QWERTY playing and a simulated performer, all publishing midi/note/on|off.

exportsignature
mountKeysmountKeys(container, { signals, chord, base = 48, octaves = 2, sim = true, capture = true }) → { piano, sim, update(dt), dispose(), captureBox }
KeysPianonew KeysPiano(container, { base, octaves, semitones, fill, keyWidth, velocity, minBase, maxBase, onNote, onOctave }) · press(note, vel01) · release(note) · releaseAll() · setBase(n) · handleKeyDown(e), handleKeyUp(e) · captureEnabled
SimPlayernew SimPlayer({ press, release, base = 60, scale = [0, 2, 4, 7, 9], density = 1 }) · toggle(on) · update(dt)
PIANO_KEYMAP{ a: 0, w: 1, s: 2, … ';': 16 }
js
import { mountKeys } from '@openav/keys';
const keys = mountKeys(document.querySelector('#keys'), { signals, base: 48 });
// every frame: keys.update(dt);

@openav/drums#

L1 input and L4 output · a synthesized drum kit, a 16-step sequencer, and its grid UI; publishes drum/* in the same shapes as the microphone's drum detection.

exportsignature
mountDrumsmountDrums(container, { signals, engine, autoEnableEngine = true, onStep, onHit, onTakeover, bpm = 112, pattern, clock = 'frame', lang }) → { seq, engine, root, clock, play(on), setPattern(p, { text }), setBpm(bpm), update(dt), deliver(), phase(), now(), info(), dispose() }; clock: 'lookahead' schedules the hits ahead on the kit's audio clock (oav-p5 0.6 uses it) and plays a compiled rhythm line as written; lang: 'zh' names the lanes in Chinese; rhythm: <@openav/pattern> (or useRhythm(mod)) makes the line over the grid editable and the cells rewrite it, with history / undo(), Copy and Open in Strudel (0.7)
DrumSequencernew DrumSequencer({ onHit(lane, vel), onStep(i, n), bpm = 112, swing = 0.12, humanize = 0.35, pattern = 'four on floor' }) · setPattern(nameOrGrid) · toggleCell(lane, i) · toggle(on) · update(dt) · grid, bpm (the frame clock)
DrumScheduler, DrumTransportthe lookahead clock: a grid or a compiled line → timed events, positions in bars turned into seconds by a tempo map (no drift); the runtime with a Web Worker heartbeat, the audio clock, and steps / hits told when heard; follow({ pos, at, bpm }) plays on an external clock (a small error pulled in by tempo, a large one a jump onto its grid), followInfo(), unfollow()
drumEnginedrumEngine({ samples }) → a sound engine (see Sound); noteOn(note, vel, time) plays at time on its own AudioContext and returns { time, cancel() }
PATTERNS, GMpattern presets; General MIDI drum notes { kick: 36, snare: 38, clap: 39, tom: 45, hat: 42, openhat: 46 }
js
import { mountDrums } from '@openav/drums';
const drums = mountDrums(document.querySelector('#drums'), { signals });
// every frame: drums.update(dt);

@openav/mapping#

L2 mapping · routes from signals to params, with curves, smoothing, learn and saved profiles.

exportsignature
Mappernew Mapper({ signals, params, profile = 'default', onChange, onLearn, base }) · addRoute(route) · removeRoute(id) · routesFor(target) · learn(target) · update(dt) · toJSON() · fromJSON(routes) · save() · load() · dispose() · routes, learnTarget
LearnWizardnew LearnWizard({ mapper, keys, onChange }) · start() · skip() · back() · stop() · sync() · active, current, index, total, done, added: "map the knobs in order", see Score & Director
js
import { Mapper } from '@openav/mapping';
const mapper = new Mapper({ signals, params });
mapper.addRoute({ source: 'midi/cc/74', target: 'bloom', curve: 'exp', smooth: 0.1 });
// every frame: mapper.update(dt);
// a knob that nudges the timeline instead of replacing it, and gives the param back when you let go:
// mapper.base = () => timeline.state();
// mapper.addRoute({ source: 'midi/cc/71', target: 'bloom', mode: 'trim', outMin: -0.3, outMax: 0.3, release: 4 });

Full reference: Mapping.

@openav/chop#

L2 mapping · values over time, the way TouchDesigner's CHOPs shape them: Lag, Trigger (envelope), Speed, Spring, Trail, Slope, Count. Pure logic, no clock of its own: every step is told the seconds that went by and is solved exactly over them, so 30 fps and 144 fps draw the same curve. What the parameters mean follows Derivative's TouchDesigner documentation; the code is OAV's own. In a p5 sketch, oav-p5 gives these one call each: p5 one line.

exportsignature
approachapproach(current, target, seconds, dt) → one step of a one-pole lag; seconds = time to 63% of a change (the smooth of @openav/mapping, which steps with it)
Lagnew Lag({ up = 0.1, down = up }) · step(input, dt, up?, down?) → output · reset(v?): up while rising, down while falling (Lag CHOP's Lag 1 / Lag 2), in TouchDesigner's seconds (about 90% of a change)
envelopeenvelope(times, t, attack = 0.01, decay = 0.3, peak = 1) → the Trigger CHOP's level at t for events at times (seconds, oldest first): a straight attack (0 → peak), then 0 after exactly decay; a retrigger starts where it is · envelopeStage(elapsed, attack, decay, from, peak)
Speednew Speed() · step(rate, dt) → position: rate per second
Springnew Spring({ stiffness = 100, damping = 6 }) · step(target, dt) → position (velocity alongside): a mass on a spring pulled to the input, solved exactly · springStep(x, v, target, k, c, dt) → [x, v]
Trailnew Trail({ seconds = 2, rate = 60 }) · step(value, dt) → the last seconds, 60 values a second plus the newest, oldest first, fixed length
Slopenew Slope() · step(value, dt) → change per second
Countnew Count({ threshold = 0.5 }) · step(on, limit = 0) → times it turned on, looped to 0 … limit − 1 with a limit · wrapCount(total, limit)
TD_LAG_RATIO, DEFAULTSMath.LN10: two kinds of seconds. Lag and lag() take TouchDesigner's Lag CHOP seconds (about the time to follow 90% of a change), so lag(x, 0.1) moves like a Lag CHOP set to 0.1; underneath, Lag divides by TD_LAG_RATIO (2.3) to get its time constant. approach(…, seconds) takes that time constant itself (63% of a change, what @openav/mapping's smooth always meant); the defaults above
js
import { Lag, envelope } from '@openav/chop';
const vu = new Lag({ up: 0.03, down: 0.4 });       // opens at once, closes slowly
// every frame: r = 50 + vu.step(level, dt) * 300; pump = envelope(kickTimes, now, 0.01, 0.3);

@openav/stage#

L3 world · the world shell: lifecycle and param aggregation, no renderer.

exportsignature
Stagenew Stage({ container, params, signals, io = {} }) · register(world) · activate(name) (async) · frame(dt, baseState) → state · active, activeName, worlds, io
createCanvascreateCanvas(container, { alpha = false }) → { canvas, ctx, fit() → { w, h }, dispose() }
js
import { Stage, createCanvas } from '@openav/stage';
const stage = new Stage({ container, params, signals });
stage.register(world);
await stage.activate(world.name);
// every frame: const state = stage.frame(dt, timeline.state());

@openav/world-webtoe#

L3 world · performs a WebToe node patch as a world; params reach the patch's ext('name', fallback) bindings.

exportsignature
webtoeWorldwebtoeWorld({ name = 'webtoe', app = 'https://webtoe.openaudiovisual.com/', project, params = [], extra }) → a world

See Writing a world.

@openav/sound#

L4 output · instruments in the page behind a small engine contract: a Salamander grand piano, mallets, strings, organ, choir, harp and synth presets, chosen from a picker; engine params become sound/* params.

exportsignature
Soundnew Sound({ signals, params, engine, instrument, remember, picker }) · enable() (from a click) · update(state) per frame · setInstrument(id) · instrument · status · onChange(cb) · dispose() · enabled
toneEnginetoneEngine({ instrument = 'synth/pad', baseUrl, instruments, cdn, drumChannel = 10 }) → engine with params cutoff, space, volume plus the instrument's own
registerInstrumentregisterInstrument({ id, name, category, params, defaults, credit, create(Tone, ctx) }, { replace }); also getInstrument, listInstruments, instrumentGroups, onInstrumentsChange
registerSynthPresetregisterSynthPreset({ id, name, voice, oscillator, envelope, filter, effects, … }) → synth/<id>
modalInstrumentmodalInstrument({ id, name, partials, strike, damp }) → a mallet-style instrument from data
mountSoundPickermountSoundPicker(el, sound, { lang, className }) → the picker the console uses

Engine contract: { params, enable(), noteOn(note, vel01), noteOff(note), set(key, value), dispose() }. The instrument list and how to add one: Sound.

js
import { Sound, toneEngine } from '@openav/sound';
const sound = new Sound({ signals, params, engine: toneEngine({ instrument: 'piano' }) });
button.onclick = () => sound.enable();
// every frame: sound.update(state);

@openav/osc#

L4 output · OSC from the browser through a small Node bridge to UDP.

exportsignature
OscOutnew OscOut(url = 'http://127.0.0.1:7456') · enable() → Promise<boolean> · disable() · send(addr, args) · flush() per frame · rate() → messages sent since the last call · hooks onStatus(ok, info), onMsg(addr, args)
bridgenode packages/osc/bridges/osc-bridge.js [httpPort=7456] [targetHost=127.0.0.1] [targetPort=3456]

See Show control.

@openav/out#

L4 output · page parameters to physical hardware through one local bridge (node packages/out/bridge/out-bridge.mjs --config out.json, ws://127.0.0.1:6450/out): WLED light strips (DDP), serial motor boards, OSC, and DMX lighting (Art-Net, sACN, an Enttec DMX USB Pro). A watchdog sends every channel its configured safe value (or leaves a "hold" channel where it is) when the page goes quiet or the last client leaves.

exportsignature
OutClientnew OutClient({ url, id, schedule }) · connect() · simulate() · close() · set(ch, v) · batch({ ch: v }) · onStatus(fn) · status, last, bridge, beatMs — one value per channel per frame, reconnects with backoff, heartbeat
bridgenode packages/out/bridge/out-bridge.mjs [--port 6450] [--config out.json] [--no-watchdog] · sinks ddp serial osc udp-json log, and for DMX on dmx/<universe>/<address>: artnet (unicast host), sacn (multicast or host, priority, source), enttec (path, universe), 40 Hz + a keep-alive each second, a flash guard per channel ("flashGuard": false | { maxFlashHz, exempt })
labmeta.params[i].out: "light/1/r" binds a param (0..1 by min–max, outRaw for the raw value); ?out=sim · ?out=0 · ?out=ws://…

See the package README for the config file and the watchdog rules.

@openav/dmx#

L4 output (lighting) · DMX from a page, as pure logic: fixture profiles (open-audiovisual/fixture@1), a patch that turns properties (dimmer, color, pan, tilt, strobe, zoom, 0..1) into each light's bytes, and an engine that renders every light at any moment as a function of time: base scenes → cues with fades → chases on beats → effects → live values → per-fixture limits → grand master → blackout. Safety is on by default, and the flash cap (3 a second) is held per fixture, twice: the engine slows the effects and chases that flash one fixture until their rates there add up to at most the cap (state(t).slowed), and every dmxTransport() puts each frame through a flash guard that holds what a fixture really emits, live values included (rises are rationed, falls always pass; { flashGuard: false } to switch it off, and the monitor then says so). A strobe channel whose profile gives Hz is held to the cap, one with no Hz stays open; render(t, { beat }) needs bpm with it, since the cap reads the tempo; control channels (reset, lamp, built-in programs) are written only by control(); blackout leaves pan and tilt where they are. The bytes of Art-Net, sACN and the Enttec DMX USB Pro come out of pure encoders; dmxTransport() sends what changed each frame (to memory, through the out-bridge, or by Web Serial), dmxParams() makes the engine's control points params, and mountDmxMonitor() shows the rig on the page. Nothing has been tried on a real fixture, node or interface. The chapter is DMX lighting.

exportsignature
Patchnew Patch({ profiles }) · add({ id, profile, mode, universe = 1, address, name, groups, limits }) (throws past 512, unknown mode) · check() → overlaps · ids(target) · render(states, { master, blackout, maxFlashHz = 3, controls }) → Universes · resolve(id, props) · toJSON() · Patch.fromJSON(json, { profiles })
DmxEnginenew DmxEngine(patch, { maxFlashHz = 3, bpm = 120 }) · scene(name, { target: props }) · base(...names) · cue(name, { scene, fadeIn, fadeOut, curve }) · go(name, at) · release(at, fade) · chase(name, { steps, every, unit: 'beat' | 'second', fade, start }) · effect(name, { target, property, wave: sine | saw | square | chase | flicker | rainbow, rate, unit, depth, phase, spread, width, seed }) · run(name, on) · remove(name) · set(target, props) · clear(target, keys) · control(id, key, byte) · master, blackout, maxFlashHz · render(t, { beat, bpm }) → Universes · state(t) → { fixtures, capped, slowed }
livedmxTransport('sim' | 'bridge' | 'serial', { patch, flashGuard = true, maxFlashHz = 3, now, client | universe }) · send(universes) → channels changed · bytes(id) · status · flashGuard → { on, unit, maxFlashHz, held } · connect() (serial, from a click) · close() · new FlashGuard(patch, { maxFlashHz }) · apply(universes, t) · held · dmxParams(engine, { groups, effects, chases }) → { params, apply(state, t) } · mountDmxMonitor(el, { patch, transport, engine }) → { update(universes?), look(id), dispose() } · engine tune(name, { rate, depth }, at) · submaster(target, level) · describe()
Universe · Universesnew Universe(id) · get(address) · set(address, value) · write(address, values) · fill(v) · copy() · data (Uint8Array, 512) · Universes: get(id) · bytes(id) · ids() · entries()
fixturesFIXTURES (generic: dimmer, RGB, RGBW 4/6 ch, RGBA, RGBAW+UV 6/8 ch, one-colour strobe, moving head 8/16 ch, all "verified": false) · fixtureById(id) · validateFixture(profile) → problems · loadFixture(profile) · rgbToChannels([r, g, b], colors) · schema @openav/dmx/fixtures/fixture.schema.json
protocolsencodeArtDmx(data, { universe, sequence, physical }) / decodeArtDmx(bytes) (ArtDmx, UDP 6454) · encodeSacn(data, { universe, cid, source, priority, sequence }) / decodeSacn(bytes) · sacnAddress(universe) (E1.31, UDP 5568) · encodeEnttecDmx(data) / decodeEnttecDmx(bytes) (DMX USB Pro, label 6)

node tools/import-ofl.mjs <OFL checkout> --list tools/ofl/batch-1.json converts fixtures from the Open Fixture Library (MIT) into this format (or name them: … fixtures/<maker>/<fixture>.json), and refuses one the engine would get wrong on a real light. Forty-two are in fixtures/imported/, all "verified": false; they stay out of FIXTURES, and loadImportedFixture(id) from @openav/dmx/fixtures/imported.js (or device(id) of @openav/devices) imports the one you ask for. Art-Net™ Designed by and Copyright Artistic Licence.

@openav/output#

L4 output (picture) · the stage on a projector, a second screen, OBS or TouchDesigner. An output window that mirrors the stage's canvas (captureStream() into a <video>: one render, the same frames) or opens the same page again at its clean address as a sync follower; fullscreen on a chosen screen where the Window Management API allows it (asked only from a click in the output window); four-corner correction as one CSS matrix3d homography, with flip, a quarter turn, a black border and a soft edge, edited with four handles and a test pattern and saved per output name; crops of one canvas for projectors side by side (no edge blending); output/<name>/blackout and output/<name>/brightness as params. Any createShow() page at ?output is a clean output (&follow=oav-output to follow, &play to start). The chapter is Projection and video out. Several devices each drawing their own part of one canvas, placed by a photo, is @openav/tile; a wall of several outputs aligned from one layout file is @openav/align, whose calibration createOutputs(show, { align }) imports.

exportsignature
createOutputscreateOutputs(show, { outputs = [{ name: 'main' }], aspect = null, panel = true, via = null, storage, align = null }) → { names, open(name, { mode }), close(name), get(name), edit(name, on), pattern(name, on), lead({ channel, via }), url(name, o), exportLayout(), importLayout(doc), keys(name) }, also on show.outputs; the params at load, the stage boxed to aspect, an L4 · Output panel
openOutputopenOutput(source, { name = 'main', crop, fit = 'contain', mode = 'mirror', params, timeline, features, aspect, via, channel = 'oav-output', storage }) → { name, mode, window, closed, edit(on), pattern(on), room, set(partial), reset(), close() }; from a click
corner-pincornerPin(corners, width = 1, height = 1) → 9 numbers (throws on a quad that is not convex) · toMatrix3d(H) → 'matrix3d(…)'
cropcropBox({ crop, source, box, fit = 'contain' }) → { clip, source }
layout fileOUTPUT_FORMAT ('open-audiovisual/output@1') · parseOutputLayout(doc) → { format, outputs } (one error listing every problem)
paramsoutputParams(names) → the entries of output/<name>/blackout (0 or 1) and output/<name>/brightness (0..1, default 1)
clean addressoutputQuery(search) → null or { name, crop, aspect, fit, follow, via, play } · outputUrl(base, { name, crop, aspect, fit, follow, via, play })

@openav/align#

L4 output (picture) · a wall of several outputs from one layout file (open-audiovisual/align@1; art-align's art-align/v1 reads unchanged): the test patterns, the vendor's 1:1 alignment chart and the work's output mapping read the same table of tiles, so a pattern right on the wall means the work is right. A manual calibration on top (open-audiovisual/align-calibration@1: four corners, a mesh, feathered edges, masks, gain per tile) with an align mode and a store, the identification screen, and the Gray-code frames for camera-in-the-loop alignment (each projector in its own colour channel; capturing and decoding photos is not built). No dependencies; three.js is passed in. The chapter is Projector and LED alignment; example 31. Its validateLayout and normalizeLayout are not @openav/tile's nor @openav/surface's.

exportsignature
layoutALIGN_FORMAT (= CONTRACT) · validateLayout(layout) → { ok, errors, warnings } · normalizeLayout(layout) · LayoutError · findLayout(layouts, name) · identityLayout(w, h, { id, title }) · scaleArt(layout, k)
mappingcomputeMapping(layout) → { format, id, art, desktop, outputs, segments, tiles, vendor, warnings } · blitPlan(mapping, { pixelRatio, buffer }) · composePlan · composeArtCanvas · artView · desktopToArt(mapping, x, y) · artToDesktop(mapping, ax, ay) · cellIdAt · analyzeOverlaps · blendWeight(tile, ax, ay) · vendorPlacements(mapping, { base })
cellsrowLabel(i) · cellSizeFor(w, h) · cellAt(seg, size, ax, ay) · cellRect(seg, size, name) · eachCell(seg, size)
patternsALIGN_PATTERNS · BAR_VARIANTS · drawPattern(ctx, mapping, pattern, { view, overlay, variant, highlight, outputs, lang }) · withTile · highlightCell · drawOutputs
Gray codegraySequence(size, { inverse, refs, axes }) · grayBitAt · grayRuns · channelPlan(mapping) · drawGrayFrame(ctx, mapping, frame, { assign, view }) · decodeGrayBits(bits) · grayEncode · grayDecode · bitsFor · frameLabel(frame, lang)
calibrationCALIBRATION_FORMAT (= CAL_CONTRACT) · normalizeCalibration(cal, mapping, variant) · defaultZone(tile) · normalizeZone · warpPoint(zone, u, v) · squareToQuad(q) · featherAt(f, u, v) · zoneGrid(zone, n) · rotateZone(zone, dir) · quadOk(q)
WebGLcreateBlitter(THREE, renderer) · createWarpRenderer(THREE) → { build(mapping, zones, n), draw(renderer, texture, region), dispose() } · createPatternTexture(THREE, size)
venuePATTERN_SOURCES · drawSource(g, mapping, source) · createCalStore({ bridge, prefix, storage }) · createAlignUI(o) · drawChart(ctx, mapping, outputId, opts) · drawIdent · drawIdentBase · drawIdentLive · normalizeAlignArgs(a, { patterns, fallback })
with @openav/outputzoneToRoom(zone, tile, output) → { room, dropped } · roomToZone(room, tile, output, base) → { zone, dropped, mirrored } · outputsFromAlign(layout, { variant }) → for createOutputs(show, { align })

@openav/record#

L4 output (video branch) · the performance video: the work and the performer's camera composited into one canvas of an exact size (vertical 1080×1920, 4:5, 2.7K, 4K, landscape, square) and recorded with the work's own sound by one MediaRecorder, so picture and sound are in sync by construction; plus the sound as its own file, an event log, and MIDI takes (record what you play, play it back into the show, .mid in and out).

exportsignature
Compositornew Compositor({ size = 'vertical-1080p', layout = 'stack', layoutOptions, getWorkCanvas, background, mirrorCam = true, maxFps = 60, onDraw(ctx, rects, comp) }) · start() · stop() · draw() · setSize(size) · setLayout(layout, options) · setCamera(stream | video | null) · drawOnCamera(fn(ctx, w, h)) · canvas, rects, video
Recordernew Recorder({ canvas, fps = 60, audioTracks = [], audioOnly = false, videoBitsPerSecond, mimeType }) · start({ timeslice = 1000, ondata(blob, seq), keep }) · stop() → Promise<{ mimeType, ext, bytes, durationMs, width, height, blob, … }> · t0
AudioTapnew AudioTap({ context, sources, captureDestination }) · add(node | stream | track, { bus }) · captureDestination() · addMicrophone() · level() · tracks (work + mic), workTracks (work only)
EventLognew EventLog({ now, filter, throttleMs }) · start(at) · stop() · add(name, value) · attach(signals) · toJSON() · toTake()
TakeRecorder · TakePlayernew TakeRecorder({ signals, filter = /^midi\//, overdub }) · start() · stop() → take · new TakePlayer({ signals, take, loop = true, speed = 1, yieldToLive, resumeAfter, clock }) · play() · pause() · stop() · seek(ms) · update(dt)
pure helperslayoutRects(layout, out, src, opts) · PRESETS · presetById · resolveSize · recommendedFps(w, h) · recommendedBitrate(w, h, fps) · pickMime(isTypeSupported, { audioOnly }) · extFor(mime) · normalizeTake · validateTake · trimSilence · quantizeTake · toMidiFile(take) → Uint8Array · fromMidiFile(bytes) → take
camerasopenCamera({ deviceId, width = 1920, height = 1080, fps = 30 }) → MediaStream · listCameras() · listMicrophones()

Layouts: stack (work on top at full width, camera below), pip (camera inset in a corner), side (work left, camera right), work. 60 fps up to about 1080×1920, 30 fps for 2.7K and 4K; webcams stop at 1080p, so a 4K frame enlarges the camera.

js
import { Compositor, AudioTap, Recorder, openCamera } from '@openav/record';
const comp = new Compositor({ size: 'vertical-1080p', layout: 'stack', getWorkCanvas: () => canvas });
comp.start();
await comp.setCamera(await openCamera());
const tap = new AudioTap({ context, sources: [workOutput] });
const rec = new Recorder({ canvas: comp.canvas, fps: 60, audioTracks: tap.tracks }).start();
// later: const { blob, mimeType } = await rec.stop();

Package README with the MIDI takes: packages/record. Example: 10-record.

@openav/fab#

L4 output (physical branch) · can it be made? A manufacturability report for any mesh (watertight, volume, overhang, thinnest wall, grams of PETG / PLA, one Chinese warning per problem) and STL / OBJ / GLB files; STEP and DXF when the shape is a smlibwasm Part or Shape. smlibwasm and manifold-3d are not bundled: smlib() / manifold() import() them from a URL on first use.

exportsignature
Fabnew Fab({ urls: { smlib, manifold }, scale, importer, download, context }) · check(x, opts) → report · export(x, fmt, opts) → Promise<{ bytes, mime, ext, report }> (stl obj glb step dxf) · save(x, fmt, { name, params, note }) through saver(bytes, info) or a browser download · smlib() · manifold() · meshOf(x)
pure functionscheckMesh(mesh, { angle = 45, minWall = 1.2, bed = [320, 320, 325], wallSamples = 2000 }) · weldMesh(mesh) · meshOf(x, { scale }) (TriMesh, smlibwasm Part, three.js Mesh/Object3D, Y up becomes Z up) · toStlBytes · toObjText · toGlbBytes

@openav/hw#

L4 output (physical branch) · what goes inside. fab checks the shell, hw checks the electronics. A spec lists the parts and the wires ({ board, parts: { id: { part, have } }, wires: [['mcu.4', 'acc.SDA'], …] }), and hw finds the nets and reports, one Chinese sentence per problem: a 3.3 V signal into a 5 V LED strip, a voltage above what a pin takes, a supply out of range or only there on the charger, ESP8266 boot pins, one pin wired to two jobs, I²C address clashes, current beyond a regulator, battery hours. The parts library takes every number from a datasheet; what could not be confirmed is null (待查) and the check says it cannot tell.

exportsignature
Hwcheck(spec) → { ok, issues: [{ level, code, text, at }], warnings, notes, nets, power: { rails, battery }, i2c } · diagram(spec) → SVG string · bom(spec) → { have, buy, unknown } (no prices, no shop links) · parts · part(key) · resolvePin(spec, ref) · nets(spec)
HW_PARTSthe library: Feather HUZZAH ESP8266, Arduino Leonardo and UNO R3, RC522, HC-SR501, 10 kΩ pot, LIS3DH, MPU-6050 (GY-521), WS2812B, SK6812, NeoPixel rings 12 and 16, 1-cell LiPo (JST-PH), TP4056 and Micro-Lipo USB-C chargers, Qi receiver

@openav/timeline#

Spine · automation, scenes and transport; pure logic.

exportsignature
Timelinenew Timeline({ params, automation = {}, scenes = [], total = 600, score = null, start = null, loop = false, onCue = null, anchor = null }) · play() (releases a hold), pause(), toggle(), seek(t), jumpScene(d), next() (releases a hold, else a scene on), prev(), release(), reset() (to start, default 0) · advance(dt) · state(t), valueAt(key, t) · sceneIndexAt(t), currentScene(t), sceneEnd(i) · onSceneChange(cb(i, scene, { cause })), onSeek(cb(t, kind)) · layer(key, value, t) · keyframes [t, value, curve?] ('linear' · 'ease' · 'in' · 'out' · 'step') · loop (true, 'scene', a scene id, { from, to }), onLoop(cb) · cues(), onCue(cb(cue, { cause })), fireCue(cue) · record(key, source), stopRecording(), onRecord(cb), mergeTake(key, take, opts) · per-segment automation { key: { segmentId: [[p, value, curve?], …] } }, lanePos(t), laneTime(id, p), lanePlan(), lanes() · exportAutomation({ keys, as, precision }), importAutomation(doc, { keys, replace, ignoreCut }) · anchor(epoch, opts), unanchor(), drift(), onDrift(cb) · follow(source, opts), unfollow(), following, followStatus(), onFollow(cb) · t, playing, holding, rate, total, start, score
compileLane, decompileLane, lanePos, laneTime, isLane, AUTOMATION_FORMATthe segment-lane conversions as pure functions over a segment table [{ id, start, end }] (score.rootSegments), for tools that have no timeline

A keyframe's third item is the curve of the segment that ends at it; a keyframe without one is linear, exactly as before. A scene's cues fire when playback passes them, never on a seek. record() writes a value source (a knob override) into a lane while the timeline plays. CURVES is exported too. Curves can be written per segment, saved as JSON and read back, and the timeline can watch the wall clock: Lanes, Saving and loading automation, Wall clock, or follow another timeline's clock: Following another clock.

See Show control.

@openav/score#

Spine · the score and the director: a show written as segment lengths, and the modules that perform the segments. Pure logic, no DOM.

exportsignature
Scorenew Score({ cuts, cut }) · table() · total · segmentAt(T), indexAt(T) · locate(T), timeAt(id, p) · cueTime('seg.name') · cuesBetween(T0, T1) · cues() · scenes() · validate() · cuts, cut, segments (each with its meta), startT, scale, baseTime(T), rootSegments, allSegmentIds()
ScoreErrorthrown by an invalid score; problems lists every reason
Directornew Director({ score, modules, api, onStatus, onCue, maxStep }) · update(T, dt, { holding, playing }) · param(key, value, T) · seek(T) · reset() · status() · register(module)
js
import { Score, Director } from '@openav/score';
const score = new Score({ cuts, cut: 'full' });
const director = new Director({ score, modules, api });
// every frame, after timeline.advance(dt):
director.update(timeline.t, dt, { holding: timeline.holding, playing: timeline.playing });

Full reference: Score & Director.

@openav/pattern#

Spine · rhythm in one line: mini-notation, the way TidalCycles and Strudel write rhythm, read into the hits of each bar. Pure logic. An independent implementation from their public documentation (the writing comes from TidalCycles and Strudel).

exportsignature
compilecompile(src, { words = WORDS }) → { ok, error, src, voices, layers, period, eventsInBar(bar, { seed = 0 }) }, never throws · eventsInBar (bars from 1) → [{ word, voice, n, pos, dur, vel, layer, token: { start, end } }] sorted by pos (0..1 in the bar) · error → { code, index, length, message, hint }, code one of empty unclosed unexpected bad-number bad-euclid unknown-word unsupported
parseparse(src) → { ok, tree } or { ok: false, error }: nodes step rest seq layer alt fast slow euclid maybe, each with its character range
WORDSbd kick · sd snare · hh hat · oh openhat · cp clap · rim/rs · lt mt ht toms · cr crash · rd ride · cb cowbell, and the kit's own names
euclideuclid(pulses, steps, rotate = 0) → booleans (Toussaint 2005)
fromGridfromGrid(grid, { steps = 16, words, order }) → a line that plays exactly the grid, written the way a person would: bd*4, [~ sd]*2, bd(3,8,2), else beat by beat bd [~ ~ ~ bd] bd*2 ~ (0.7)
toGridtoGrid(srcOrCompiled, { bar = 1, steps = 16, seed = 0, bars = 16 }) → { ok, grid, words, voices, exact, lost: { offGrid, stacked, varies, random, samples } }: bar bar on the steps and what they cannot hold; seed decides each ? (as in eventsInBar), bars is how many bars it looks through to tell whether the others differ (lost.varies) (0.7)
fromStrudelfromStrudel(code) → { strudel, ok, src, bpm, ignored, unsupported }: s("…") / sound("…") copied from strudel.cc, .fast / .slow folded in, setcpm / setcps as bpm (0.7)
toStrudel, strudelUrlstrudelUrl(src, { bpm, comment }) → https://strudel.cc/#… (the line as s("…") with setcpm(bpm/4), base64 in the #); open it in a new tab (0.7)

Writing: spaces (steps share the bar) · ~ - rest · [ ] group · , layers · *n faster · /n slower, across bars · < > one per bar · (k,n,r) Euclidean · !n and ! repeat · @n and _ longer · ? ?0.3 drop by chance (seeded) · bd:2 sample number. . | { } are refused with a hint (rests are ~ or -).

js
import { compile } from '@openav/pattern';
const p = compile('bd*4, [~ sd]*2, hh*8');
p.eventsInBar(1);   // kick 0 .25 .5 .75 · snare .25 .75 · hat every 1/8

@openav/console#

Spine · the director's desk: transport, layer panels, params with learn, signal meters, performance mode.

exportsignature
mountConsolemountConsole(el, app, { layers, signals, learnOrder, keys, curves }) → { render(state), perf, director, curves, wizard, keys, dispose() }; app = { timeline, params, mapper, signals, stage, midi?, midiPanel?, sound?, audio?, hands?, pose?, loop?, osc?, score?, director? }
Curves panelcurves: false leaves it out, { open: true } starts it open; desk.curves → { toggle(force?), open, info() } (null with curves: false). One curve per automated param across the whole show, the playhead, overrides with ↩ and ↩ all, click to seek: The curves panel
keyboardkeys: { play, next, prev, reset, perf, fullscreen, midi, cancel, curves } → a key or a list ('F6', 'KeyR', 'Shift+T'), false = off; keys: false = no shortcuts · DEFAULT_KEYS · resolveKeys(keys) · keyLabel(keys, action): Moving the shortcuts

See Show control.

@openav/monitor#

Spine · the backstage page and the WebSocket relay that feeds it.

exportsignature
MonitorFeednew MonitorFeed({ url = 'ws://<page host>:7457', hz = 15, extra }) · connect() · frame(snapshot) · extra(fn) → off() · connected, onStatus
snapshotOfsnapshotOf({ timeline, params, signals, stage, loop, extra? }, state) → a JSON snapshot; the work's own numbers (extra, the active world's monitor()) land under extra
cleanExtracleanExtra(x) → the work's numbers made safe for JSON (a number, string, boolean, null or { v, min, max, warn } per field), or null when there are none
servernode packages/monitor/server.js [port=7457]: backstage page at /, /health

See Show control.

@openav/sync#

Spine · several pages, one show: the wire between a leader and its followers, over a BroadcastChannel or the room relay. A follower's timeline chases the leader with timeline.follow().

exportsignature
createSynccreateSync({ role, channel, url, timeline, score, follow, extra, state, hz, info, accept, onFrame, onState, onGap, id, now, transport }) → a SyncLeader or a SyncFollower; a follower's timeline is made to follow it. Call sync.frame() after timeline.advance(dt) every frame; sync.close() lets go
SyncLeadernew SyncLeader({ timeline, transport, id, cut, extra, state, hz, now, onHello }) · frame() · sendState(to?) · status() · monitor() · close()
SyncFollowernew SyncFollower({ transport, id, now, timeline, info, accept, onFrame, onState, onGap, resync = true, helloEvery = 1000, takeoverAfter = 1500, resyncAfter = 1000 }) · latest() (a timeline.follow() source) · hello(reason) · frame() · status() · monitor() · close()
transportsBroadcastTransport({ channel }) · RelayTransport({ url, room, role, id }) · createTransport({ role, channel, url, id }): each is { send(msg), onMessage(cb), onOpen(cb), open, close() } and carries JSON
SYNC_VERSION1, the v of every message

Messages are frame (leader to followers, every frame), hello (follower to leader) and state (leader to one follower); work-specific data rides in extra. See Show control. @openav/tile keeps a clock of its own: no leader, every screen asks the relay what time it is and draws from that (the difference).

@openav/relay#

Phones · room-scoped WebSocket relay (server) and its browser client.

exportsignature
RelayClientnew RelayClient({ role, room, id, url, batchHz = 30, resendMs = 1000, onStatus, onSignal, onFeedback, onConfig, onSync }) · connect() · close() · set(name, value) · send(name, value, pulse, extra) · feedback(name, value) · config(key, data) · sync(msg) · status, latency, peers; role is controller, runner, monitor, leader or follower
signals helpersbindSignals(client, signals, { alias = 'any' }) · fileSignal(signals, name, value, { pulse }) · signalMeta(name, { pulse }) · aliasOf(name) · normalizeValue(name, value) · deviceId()
@openav/relay/serverattachRelay(httpServer, { path = '/relay', log, heartbeatMs = 20000, maxMessageChars = 262144, maxBytes = 1048576 }) → { hub, close() }; standalone node packages/relay/server.js [port=7458]
MidiLink (link.js)new MidiLink({ url, room, delay = 0, onMessages(list, from), onStatus }) · connect() · send(bytes, whenMs) · info() → { state, peers, rtt, trip, diff, lead, late, sent, received } · close(); LinkTiming: MIDI between pages in one room, played when it sounds at the sender (With Strudel)

See Phones, relay & surfaces.

@openav/surface#

Phones · TouchOSC-style widgets, layout JSON, theme, and autoSurface(params).

exportsignature
Surfacenew Surface(el, { layout, sink(name, value, info), haptics = true, tabs = true, orientation, onPage }) · setLayout(layout) · setPage(id) · feedback(name, value) · widget(page, id) · dispose()
signalSinksignalSink(signals) → a sink that writes into a local Signals
autoautoSurface(params, { perPage, style, pairs, meters, smooth, title }) → { layout, routes, bindings } · feedbackFor(state, bindings) · routesFromLayout(layout, params) · widgetTypeFor(param)
layoutvalidateLayout, normalizeLayout, resolvePage, autoArrange, signalNames, DEFAULT_SIZE, WIDGET_TYPES, planKeyboard
platform & themelockViewport, keepAwake, toggleFullscreen, canFullscreen, haptic, injectTheme, THEME_VARS, COLOR_NAMES, WIDGET_CLASSES
js
import { Surface, autoSurface, signalSink } from '@openav/surface';
const { layout, routes } = autoSurface(world.params);
new Surface(document.querySelector('#panel'), { layout, sink: signalSink(signals) });
routes.forEach((r) => mapper.addRoute(r));

See Phones, relay & surfaces.

@openav/remote#

Phones · the phone/iPad app and the show-side adapter.

exportsignature
mountRemotemountRemote(el, { room, relayUrl, surfaceUrl, metaUrl }) → the phone app (/packages/remote/index.html calls it)
PhoneSensorsnew PhoneSensors({ set, send }, { onKnock, onSample, notify }) · start() (from a tap) · stop() · calibrate() · setCamera(on) · denied
localSensorslocalSensors(signals, { prefix = 'phone/local/', alias = 'any' }) → PhoneSensors
attachTouchPadattachTouchPad(el, io, { onMove, onEnd })
@openav/remote/hostmountRemoteHost({ signals, params, mapper, world, room, auto, surface, feedbackHz = 10, url, mode, controllers }) → host · mountJoinCard(parent, host) (URL, QR code, status)
@openav/remote/relay-pickpickRelay({ hostname, search, declared, storage }) → { mode: 'local'|'public'|'custom'|'off', url, room, shared } · isLocalHost(h) · PUBLIC_RELAY · phoneUrl({ base, room, relay })
@openav/remote/qrqrSvg(text, { ecc = 'M', margin = 2, scale }) → an <svg> string · qrMatrix(text, { ecc }) → { version, size, mask, rows } (byte mode, versions 1–10)

See Phones, relay & surfaces.

@openav/tile#

Phones · several screens lying on a table become one canvas: one photo of their markers places every screen, one clock shared over the relay and one seed keep them together, and each screen draws only its own piece. Not @openav/output, which shows one stage, rendered once, through projector windows: here many devices each render their part of one canvas, placed by a photo. Its clock is not @openav/sync either: no leader page streams a playhead, every screen asks the relay what time it is (the difference is in the chapter). The chapter is Several screens, one canvas; example 30; the camera page is packages/tile/?room=<name> (?demo=1: a synthetic photo, no hardware).

exportsignature
joinTilejoinTile({ room, url, id, signals, container, ui = true, storage, Link }) → tile · view · time() (shared seconds) · now() · seed · size() · markers(on) · attach(signals) · syncTimeline(timeline, dt) · on('layout' | 'roster' | 'mode' | 'show' | 'view' | 'resize', cb) · status() · close(); publishes tile/markers, tile/synced, tile/layout (pulse) · tileId(storage) · helloName(id) · HELLO_RE · TILE_KEYS
tileWorldtileWorld(world, tile) → the world plus the param tileMarkers (0 show · 1 markers) and io.tile / ctx.tile; TILE_PARAMS, TILE_ROUTES (tile/markers → tileMarkers)
tileViewtileView(layout, id) → { ok, canvas, device, toCanvas, toDevice, scale, angle, bounds, polygon, point(x, y), fromDevice(x, y), matrix(pixelRatio), apply2d(ctx, pixelRatio), applyP5(sk), css(dpr), visible(x, y, r) } or { ok: false, reason } · soloView(w, h, id)
solveLayoutsolveLayout({ devices: [{ id, w, h, index, markers: [{ device, photo }] }], photo, minMarkers = 4, reference, refine = true, rejectPx = 6 }) → { ok, layout, report, reason }, never throws · validateLayout(layout) → { ok, errors } (a tile layout, not @openav/surface's) · LAYOUT_VERSION
geometryhomography(src, dst, { normalize = true }) (normalized DLT, ≥ 4 points, never throws; @openav/output's cornerPin is the four-corner case for CSS) · fitSimilarity(src, dst) · similarityMatrix, similarityOf, similarityScale, similarityAngle · mul3, inv3, apply3, det3, rmsError; @openav/tile/solve also has I3 and normalizer
markersmarkerGrid(w, h, { short = 4, fill = 0.72 }) · markerId(device, cell) · decodeMarkerId(id) · correspondences(found, roster, grid) · drawMarkers(ctx, { w, h, index, grid, label }) · GRID_DEFAULTS · PER_DEVICE (50) · MAX_DEVICES (20) · DICT_NAME (DICT_5X5_1000), markerCode(id), markerBits(id)
clocknew ClockSync({ now, window = 60000, keep = 40 }) · add(t0, server, t1) · offset · rtt · now() · ready · clockSample(t0, server, t1) · estimateOffset(samples) (the quickest round trip) · TileLink (a RelayClient that pings the relay and keeps the clock)
@openav/tile/detectloadOpenCV(url = OPENCV_URL) (OpenCV.js 4.12.0 from jsDelivr, the camera page only) · detectMarkers(cv, image, { maxSide = 4096, params }) → { found: [{ id, corners }], rejected, ms, w, h } · greyPixels(src, maxSide) · OPENCV_VERSION, OPENCV_URL

Subpath entries @openav/tile/solve, /clock, /marker, /view and /detect need their own import-map line. layout.json: { version: 1, reference, canvas: { w, h }, plane: { matrix3x3 }, devices: [{ id, w, h, kind: 'planar', similarity: { a, b, tx, ty }, matrix3x3, rms, pose: null }] }; pose is kept for a screen posed in 3D.

@openav/devices#

Glue · one collection of show devices: every MIDI controller profile (hand-written and imported), every DMX fixture, every part of the electronics library, and hand-written records for cameras, audio interfaces, sensors, LED and DMX interfaces and printers, under one outer record (open-audiovisual/device@1, @openav/devices/device.schema.json) with a source for every fact. Nothing is copied: each profile, fixture and part stays in its own file and its record is read off it (node tools/build-devices.mjs writes the list, catalog.js), so listing loads no profile. The chapter is Devices.

exportsignature
devicesdevices({ kind, q, connection }) → frozen rows { id, kind, manufacturer, name, aliases, connections, protocols, verified, from, file }; q matches every word in the name, aliases, maker or id
deviceawait device(id, options) → { id, kind, name, record } and, by kind: midi-controller profile · routes(bindings, options) · addTo(controllers); dmx-fixture profile · patch(patch, { id, universe, address, mode }); part part; camera, audio-interface constraints(deviceId) · find() · open() (the only call that asks for a permission)
deviceKindsmidi-controller · dmx-fixture · dmx-interface · led-controller · sensor · camera · audio-interface · projector · display · printer · part

@openav/mcp#

Glue · a zero-dependency MCP server over stdio for coding agents: node packages/mcp/server.js. Tools and arguments are in For AI agents.

↑ Back to top · All chapters