metronome
Triggers a visual and/or audible metronome marker at the cue’s location or a specified target: element.
The metronome can follow scrolling objects, stay fixed to the viewport, and optionally send OSC messages.
Syntax
metro(bpm:<number>,beats:<number>,visual:<type>,audio:<0|1>,
position:<fixed|scrolling>,osc:<0|1>,uid:<string>,
target:<uid>,hideTarget:<0|1>,showcount:<0|1>,hold:<beats>,
colour:<csscolour>,size:<pixels>,trig:<auto|edge>)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| bpm | number | 120 |
Beats per minute. Controls metronome speed. |
| beats | number | 4 |
Number of beats per cycle. |
| visual | string | "circle" |
Visual style (circle, hex, future shapes). |
| audio | 0 / 1 |
0 |
Enables click sound. |
| osc | 0 / 1 |
0 |
Publishes OSC beat messages. |
| uid | string | "default" |
Unique metronome identifier. |
| showcount | 0 / 1 |
1 |
Show count number inside shape. |
| hold | beats | 0 |
Stop after defined duration. |
| colour | CSS color | "red" |
Circle colour. |
| size | pixels | 50 |
Circle diameter. |
Behaviour
- Runs as overlay DOM element (not part of the SVG).
- Supports audio click and OSC output.
- Started from a console line, a metro has no position on a timeline: it free-runs from the moment the line runs.
- Timing is a lookahead scheduler on the shared audio clock, not the
frame loop: beats are frame-rate independent, keep going while the tab
is in the background, and resync cleanly instead of "catching up" in a
burst after a stall. One metro per
uid— retriggering restarts it. - Supports multiple concurrent metronomes (UID required).
OSC Message Format
With osc:1 every beat sends one message to the OSC out port:
/oscilla/metro/<uid> beat(int) bpm(float)
/oscilla/metro/m21 3 90.0
Example receivers for Pd, Max and SuperCollider: OSC Output.
Known Limitations
- OSC feedback not currently aware of phase differences between UIDs.
- Appearance position is based on CSS absolute, not SVG hitbox.
Driving other cues
A metronome publishes its pulse, so the rest of the score can move in time with it rather than only hearing it:
| Channel | Meaning |
|---|---|
beat |
which beat of the bar, 1-based |
phase |
position through the bar, 0–1 |
bar |
bars since it started |
phase is continuous, not stepped — it is what you want for anything that
should turn or travel in time:
metro(uid:click, bpm:96, beats:4)
rotate(uid:r1, dir:1, dur: follow(click.phase, 4, 0.5))
beat steps 1, 2, 3, 4 and is the musical fact; bar is a counter that keeps
climbing. All three come off the same shared grid the clicks are scheduled on,
so they stay in phase across the network the way the clicks do.
Tip: use ← → or ↑ ↓ to navigate the docs