Skip to content

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.

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.

  1. Mark each port that should receive clock with send_clock = true in its entry in ~/.resonon/preferences.toml, and run reload_preferences():

    [[midi.outputs]]
    alias = "daw"
    port = "IAC Driver Bus 1"
    send_clock = true
  2. Turn clock on and play:

    set_midi_clock_send(true);
    set_bpm(120);
    PLAY;
  3. 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.

  1. Declare the port the clock arrives on as an input:

    [[midi.inputs]]
    alias = "daw"
    port = "IAC Driver Bus 1"
  2. Follow it:

    set_midi_clock_source("daw");
  3. If the piece sends patterns from on_cycle callbacks, run them once for the first cycle — the DAW’s start, not PLAY, starts the transport:

    prime_cycles();
  4. 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.

midi_clock_report(); // source, tempo and transport
midi_routing_report(); // the clock mode, and which ports receive clock

If 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.