Sync to a MIDI Clock
Resonon either sends MIDI clock and leads, or follows a clock from elsewhere — one or the other. Clock runs with the transport of a live session; a file run ends, and its clock with it, after its last statement. The functions are in the MIDI reference; Clock & Alignment explains how both work.
Set up a virtual port
Section titled “Set up a virtual port”To sync with a DAW on the same machine, share a virtual port. On macOS, open Audio MIDI Setup,
choose Window → Show MIDI Studio, double-click IAC Driver and check Device is online.
resonon --list-ports then shows IAC Driver Bus 1.
Lead: send clock
Section titled “Lead: send clock”-
Mark each port that should receive clock with
send_clock = truein its entry in~/.resonon/preferences.toml, and runreload_preferences():[[midi.outputs]]alias = "daw"port = "IAC Driver Bus 1"send_clock = true -
Turn clock on and play:
set_midi_clock_send(true);set_bpm(120);PLAY; -
In the DAW, set the transport to follow external MIDI clock from that port.
The port receives clock ticks plus Start, Stop and Continue. Ports without send_clock get none.
midi_routing_report() marks each port that receives clock with [clock].
You can turn clock on — for everything, or for one more port — while the music plays: the port is
sent the current position and picks up in place. set_midi_clock_send(false), or taking send_clock
out, sends it Stop.
Follow: take clock from a DAW
Section titled “Follow: take clock from a DAW”-
Declare the port the clock arrives on as an input:
[[midi.inputs]]alias = "daw"port = "IAC Driver Bus 1" -
Follow it:
set_midi_clock_source("daw"); -
If the piece sends patterns from
on_cyclecallbacks, run them once for the first cycle — the DAW’s start, notPLAY, starts the transport:prime_cycles(); -
Start the DAW. Resonon takes its tempo, and starts, stops and continues with it.
Turn it off with set_midi_clock_source(). Following turns sending off, and sending turns following
off.
Trim the follower
Section titled “Trim the follower”Resonon allows for its own output latency and plugin delay, so what you hear lands on the source’s
clock. If it still sounds early or late against the source — the source’s own sound comes out after
the clock it sends — add clock_trim_ms to the input’s entry and run reload_preferences().
Positive plays resonon later, negative earlier:
[[midi.inputs]]alias = "drums"port = "TR-8S"clock_trim_ms = 3 # the drum machine sounds 3 ms after its clockThe trim can be up to ±500 ms; a value further out is reported and ignored. A reload applies it without closing the port, and the play head moves onto it without a jump.
Check the clock
Section titled “Check the clock”midi_clock_report(); // source, tempo, transport, and when following: phase, output delay, trimmidi_routing_report(); // the clock mode, and which ports receive clockIf a device gets no clock, check that [clock] appears next to its port. If the tempo won’t lock,
check that the source is actually sending clock on the port you follow.
Related
Section titled “Related”- Align Hardware with the Mix — trim a device that is early or late
- Clock & Alignment — opt-in ports, position and tempo following
- Send MIDI to a Synth or DAW — play a DAW instrument over the same port