Skip to content

MIDI

MIDI output: tracks, control-change lanes, and port management.

fn send_rate(hz: Number) -> CcOutput

Set the CC send rate in Hz (default 30). Higher values produce smoother automation but more MIDI traffic.

Example:

track.cc(74).send_rate(60) << Sine(0.5).range(0, 127)

Parameters:

  • hz (Number) — send rate in Hz

Returns: CcOutput — the CC output handle, for chaining

MIDI output and input functions.

Track creation, port connection, and MIDI routing.

fn MidiTrack(channel: Number, velocity: Number = NUL, port_alias: String = NUL, name: String = NUL) -> MidiTrack

Creates a MIDI track on the given channel.

Example:

MidiTrack(1), MidiTrack(1, 100, "daw")

Parameters:

  • channel (Number) — MIDI channel 1-16
  • velocity (Number) — note velocity 0-127
  • port_alias (String) — output port alias (for multi-port setups)
  • name (String) — track name for logging

Returns: MidiTrack — the new MIDI track

fn output(alias: String, channel: Number) -> MidiTrack

Set the MIDI output port and optional channel.

Example:

track.output("synth"), track.output("synth", 2)

Parameters:

  • alias (String) — output port alias
  • channel (Number) — MIDI channel 1-16 (optional)

Returns: MidiTrack — the track, for chaining

fn input(alias: String, channel: Number) -> MidiTrack

Set the MIDI input port and optional channel.

Example:

track.input("keys"), track.input("keys", 1)

Parameters:

  • alias (String) — input port alias
  • channel (Number) — MIDI channel 1-16 (optional)

Returns: MidiTrack — the track, for chaining

fn monitor(mode: String) -> MidiTrack

Set the monitor mode (“auto”, “on”, “off”).

Example:

track.monitor("on")

Parameters:

  • mode (String) — monitor mode: “auto”, “on”, or “off”

Returns: MidiTrack — the track, for chaining

fn velocity(vel: Number) -> MidiTrack

Set the default velocity for this track.

Example:

track.velocity(80)

Parameters:

  • vel (Number) — default note velocity (0-127)

Returns: MidiTrack — the track, for chaining

fn cc(cc_number: Number) -> CcOutput

Get a CC output handle for the given controller number. Use << to assign values, patterns, or signals.

Example:

track.cc(74) << Sine(0.5).range(0, 127)

Parameters:

  • cc_number (Number) — CC controller number (0-127)

Returns: CcOutput — a CC output handle, assignable with <<

fn tuning(bend_range: Number) -> MidiTrack

Enable microtonal pitch bend output. Uses the MIDI default ±2 semitone range (works with any synth).

Example:

track.tuning(), track.tuning(48)

Parameters:

  • bend_range (Number) — pitch-bend range in semitones (optional; default ±2)

Returns: MidiTrack — the track, for chaining

fn mpe(range: Number, zone_lo: Number, zone_hi: Number) -> MidiTrack

Enable MPE (per-note channel allocation) for polyphonic microtonal output.

Example:

track.mpe(), track.mpe(24), track.mpe(48, 2, 9)

Parameters:

  • range (Number) — pitch-bend range in semitones (optional, defaults to 48)
  • zone_lo (Number) — low member channel (optional, defaults to 2)
  • zone_hi (Number) — high member channel (optional, defaults to 16)

Returns: MidiTrack — the track, for chaining

fn key(k: Key) -> MidiTrack

Set a track-level key (scale + root) for degree resolution and auto-quantization. Degrees (^1, ^2, …) resolve from this key without .in_key(), and absolute notes are quantized to the nearest scale tone.

Example:

track.key(Key(C4, "minor")) or track.key("minor", C4)

Parameters:

  • k (Key) — the key to apply to this track

Returns: MidiTrack — the track, for chaining

fn key(scale: String or Scale, root: Note or Number) -> MidiTrack

Set a track-level key from a scale and root (alternative to key(Key)).

Parameters:

  • scale (String | Scale) — scale name or Scale value
  • root (Note | Number) — root note (e.g. C4 or a MIDI number)

Returns: MidiTrack — the track, for chaining

fn midi_clock_follow(source: String or Boolean) -> Boolean

Enable/disable MIDI clock follow (follower mode). When enabled, resonon syncs tempo and transport to an external MIDI clock source.

Example:

midi_clock_follow("daw"), midi_clock_follow(false)

Parameters:

  • source (String | Boolean) — input port alias to follow, or false to disable

Returns: Boolean — true when enabled, false when disabled

fn midi_clock_offset() -> Number
fn midi_clock_offset(ms: Number) -> Number

Sets the MIDI clock offset in milliseconds. Positive values delay clock ticks (later), negative values send ticks earlier.

Example:

midi_clock_offset(-5)

Parameters:

  • ms (Number) — offset in milliseconds

Returns: Number — the offset value just set

fn midi_clock_send(enabled: Boolean) -> Boolean

Enable/disable MIDI clock output (master mode). Sends 24 PPQ clock ticks plus Start/Continue/Stop to all connected output ports.

Example:

midi_clock_send(true)

Parameters:

  • enabled (Boolean) — true to enable, false to disable

Returns: Boolean — the resulting enabled state

fn midi_clock_status() -> NUL

Print MIDI clock status: source, BPM, transport state, and PLL diagnostics.

Example:

midi_clock_status()

Returns: NUL — nothing; prints the status

fn midi_connect(port_name: String) -> Boolean
fn midi_connect(port_name: String, alias: String) -> Boolean

Connects to a MIDI output port with a port alias.

Example:

midi_connect("IAC Bus 1", "synth")

Parameters:

  • port_name (String) — name of the MIDI port to connect to
  • alias (String) — port alias for multi-port setups

Returns: Boolean — true on success

fn midi_connected() -> Boolean or String or Dict

Checks the current MIDI connection status.

Returns: Boolean | String | Dict — false if no ports connected, the port name String if one default port is connected, or a {alias: port_name} Dict for multiple ports

fn midi_delay() -> Number
fn midi_delay(ms: Number) -> Number

Sets the MIDI output delay in milliseconds. Positive values delay all MIDI output (notes and clock) to compensate for audio output latency.

Example:

midi_delay(15)

Parameters:

  • ms (Number) — delay in milliseconds

Returns: Number — the delay value just set

fn midi_disconnect() -> NUL
fn midi_disconnect(alias: String) -> NUL

Disconnects the MIDI output port with the given alias.

Example:

midi_disconnect("synth")

Parameters:

  • alias (String) — port alias to disconnect

Returns: NUL — nothing

fn midi_input_connect(port_name: String, alias: String) -> Boolean

Connects to a MIDI input port with a given alias.

Example:

midi_input_connect("Arturia KeyStep", "kb")

Parameters:

  • port_name (String) — name of the MIDI input port to connect to
  • alias (String) — short name for referencing this input (e.g. “kb”)

Returns: Boolean — true on success

fn midi_input_disconnect(alias: String) -> NUL

Disconnects a MIDI input port by alias.

Example:

midi_input_disconnect("kb")

Parameters:

  • alias (String) — the alias used when connecting

Returns: NUL — nothing

fn midi_input_ports() -> Array

Lists all available MIDI input ports.

Returns: Array — the available input port names as Strings

fn midi_ports() -> Array

Lists all available MIDI output ports.

Returns: Array — the available output port names as Strings

fn midi_routing() -> NUL

Displays the current MIDI routing: connected output/input ports and active slots.

Returns: NUL — nothing; prints the routing