Skip to content

Clock Sync

To play in time with a DAW, drum machine, or another sequencer, Resonon can share a MIDI clock — either driving everything as the master, or following an external source. This guide covers the virtual-port setup you need first, then both clock modes, and finally syncing with a DAW.

Clock sync rides over a MIDI port shared between Resonon and the other application. On most systems that means a virtual port.

  1. Open Audio MIDI Setup (Applications → Utilities).
  2. Choose Window → Show MIDI Studio (Cmd+2).
  3. Double-click IAC Driver, check Device is online, and make sure at least one port exists (default: “Bus 1”).
  4. Click Apply.

Install loopMIDI and create a virtual port (e.g. “loopMIDI Port”).

Use an ALSA or JACK virtual MIDI port from your audio setup.

Confirm the port is visible to Resonon:

print(midi_ports()); // "IAC Driver Bus 1" (or your virtual port) should appear
Terminal window
resonon --list-ports # same, from the command line

midi_clock_send(true) makes Resonon the clock master: it emits 24-PPQ clock ticks to all connected output ports, alongside Start, Stop, and Continue transport messages.

midi_connect("IAC Driver Bus 1", "daw");
midi_clock_send(true);
setbpm(120);
PLAY;

Disable it with midi_clock_send(false). In your DAW, set the transport to follow external MIDI clock on the same port and it will lock to Resonon’s tempo.

midi_clock_follow(alias) syncs Resonon’s tempo and transport to an external clock arriving on a connected input port:

midi_input_connect("DAW Output", "daw");
midi_clock_follow("daw");

While following:

  • Tempo is derived by averaging 24 ticks (one quarter note).
  • Start resets playback to the beginning; Stop pauses; Continue resumes.
  • A soft PLL applies phase correction (up to ~1 ms per quarter note) to stay tightly locked.

Turn it off by passing false:

midi_clock_follow(false);

Two knobs align MIDI with your audio and with external gear:

midi_delay(ms) delays all outgoing MIDI — notes and clock. Use it to compensate for audio output latency so MIDI and audio stay aligned:

midi_delay(15); // delay all MIDI output by 15ms
print(midi_delay()); // getter: prints 15

midi_clock_offset(ms) shifts only clock ticks — positive delays them, negative sends them earlier — independent of midi_delay(). The total delay on ticks is midi_delay() + midi_clock_offset():

midi_delay(15); // all MIDI delayed 15ms
midi_clock_offset(-5); // clock ticks shifted 5ms earlier
// Effective clock delay: 15 + (-5) = 10ms
// Effective note delay: 15ms
FunctionDescription
midi_clock_send(true / false)Enable / disable 24-PPQ clock output (master mode)
midi_clock_follow(alias / false)Follow / stop following external clock (follower mode)
midi_delay(ms) / midi_delay()Set / get global MIDI output delay (notes + clock)
midi_clock_offset(ms) / midi_clock_offset()Set / get clock-only offset
ErrorCauseFix
No MIDI input connected with alias '...'midi_clock_follow with an unknown aliasConnect the input first with midi_input_connect()
Tempo drifts or won’t lockNo clock arriving, or wrong portConfirm the source is sending clock and check midi_routing()
Clock send has no effectNothing follows the portSet your DAW’s transport to follow external MIDI clock

midi_routing() prints the current clock state (mode: master (sending) or mode: follower (from "...")) — check it first when sync misbehaves.

Any DAW that accepts external MIDI input can play instruments driven by Resonon over the virtual port. The steps are the same everywhere:

  1. Open your DAW’s MIDI preferences and enable the virtual port as an input.
  2. Create an instrument track and load a synth or plugin.
  3. Set the track’s MIDI input to the virtual port (or “All Inputs”) and enable input monitoring.
  4. Send notes from Resonon:
midi_connect("IAC Driver Bus 1", "daw");
let t = MidiTrack(1);
t << [C4 E4 G4 E4];
PLAY;

To record Resonon’s output as MIDI clips, arm the DAW track and press record before running your code.

Drive several DAW instruments at once by putting each on its own channel:

midi_connect("IAC Driver Bus 1", "daw");
let drums = MidiTrack(10); // channel 10 (GM drums)
let bass = MidiTrack(1);
let lead = MidiTrack(2);

In the DAW, create one track per channel listening to the shared port.

Synced and playing — now get your work out as files.