midiclock

midiclock · sources

Hardware MIDI transport bridge. Locks to a MIDI device and surfaces the System Real-Time stream as gate/CV: clock (gate) at a user-selectable subdivision — 24=quarter (default, patch directly into TIMELORDE.clock to slave it to the external transport), 12=eighth, 6=sixteenth, 3=32nd, 1=raw 24 PPQN; run (cv, 0/1) tracks transport state; midistart + midistop fire one-shot gates on MIDI Start (0xFA) and Stop (0xFC). Continue (0xFB) raises run without re-firing midistart, so downstream loops resume in place. Channel-voice messages are ignored — pair with MIDI-CV-BUDDY for note/velocity. Same Web MIDI / ConstantSource / 2 ms lookahead plumbing as MIDI-CV-BUDDY.

Brings an external MIDI device's TRANSPORT into the patch as clock and run signals — the transport-only sibling of MIDI-CV-BUDDY (which carries the notes). MIDI sends 24 clock ticks per quarter note, plus Start / Stop / Continue messages; MIDICLOCK divides that tick stream down to a usable pulse and tracks the play state. Mental model: it's the bridge that lets a hardware sequencer, drum machine, or DAW be the master clock for the whole rack — connect a class-compliant USB-MIDI device, pick it from the faceplate's device body, and patch its CLOCK output into anything that wants a beat (a SEQUENCER's CLOCK IN, TIMELORDE, an envelope trigger). Two settings, and they are deliberately different kinds of thing: the DIVISION is a param, so it can be automated, MIDI-learned, exposed on a group and undone like any other value; the DEVICE is not, because its roster lives behind the browser's own MIDI permission and differs on every machine — it is picked from the dock's device body and remembered per patch. Nothing at all happens until MIDI access is granted, which is one click, once per origin.

the faceplate

midiclockclockgateruncvmidistartgatemidistopgateaudiocvgatepitch
0 inputs · 4 outputs · 0 params

outputs

idcablewhat it does
clockgateA short ~5 ms pulse whose rising edge fires once every N incoming MIDI ticks, where N is the card's clock-division setting (MIDI runs at a fixed 24 ticks per quarter note, so N=24 gives one pulse per quarter note, 12 an eighth, 6 a sixteenth, 3 a 32nd, and 1 the raw 24-PPQN tick stream). Patch it into a SEQUENCER's CLOCK IN or TIMELORDE to slave the rack's timing to the external transport. On a MIDI Start the divider re-zeros so the first pulse lands cleanly on the downbeat.
gate / trigger; trigger — fires once per rising edge
runcvA level that sits at 0 while the external transport is stopped and rises to 1 while it is running; it latches to 1 on both MIDI Start and MIDI Continue and drops to 0 on MIDI Stop. Use it as a gate to enable downstream modules only while the master transport is playing.
control voltage (CV)
midistartgateA one-shot pulse whose rising edge fires the instant a MIDI Start message (0xFA) arrives — the 'play from the top' signal. It does NOT fire on MIDI Continue, because Continue exists precisely to resume mid-song without re-zeroing downstream loops; patch this into a reset/restart input to snap things back to the beginning when the transport starts fresh.
gate / trigger; trigger — fires once per rising edge
midistopgateA one-shot pulse whose rising edge fires when a MIDI Stop message (0xFC) arrives. Patch it where you want something to fire exactly when the external transport halts (mute an envelope, reset a counter, drop a gate).
gate / trigger; trigger — fires once per rising edge

controls

controlwhat it does
DivisorHow many incoming MIDI ticks go by between edges on the CLOCK jack. MIDI is fixed at 24 pulses per quarter note, so 1/4 (24) emits one edge per beat — the setting TIMELORDE and most hardware expect — while 1/8, 1/16 and 1/32 subdivide it and `raw` (1) passes the whole 24 PPQN stream through unchanged. Only these five are offered because only they divide 24 evenly: a division that does not lands on no note value and drifts against every other clock in the room. Changing it re-zeros the divider, so a mid-song change starts counting from the next tick rather than partway through, and the first edge afterwards is clean.
Midiclock connect {n}The one-time-per-origin permission gesture. Web MIDI needs the browser's consent before any device is even visible, and until it is granted this module has no stream to listen to and all four jacks sit at rest — so this is the first thing to press, not an optional extra. It reaches the same request every MIDI module in the rack shares, which always yields a nameable outcome: granted, refused, unsupported, or the quiet case where the browser suppressed its own prompt without telling anyone. Once access is granted the dock's device body lists the inputs it found and remembers the one you pick, so a reloaded patch re-attaches without another click.

source

midiclock.ts on GitHub.

Generated from packages/web/src/lib/{audio,video}/module-registry.ts · repo