Skip to content

Play Through from a Keyboard

A MIDI track can take notes from an input port and pass them on to its own output. Every method is in the MIDI reference; Monitoring & Thru explains what happens to the notes on the way.

Add a [[midi.inputs]] entry to ~/.resonon/preferences.toml and run reload_preferences():

[[midi.inputs]]
alias = "kb"
port = "KeyStep"
optional = true

The port name matches exactly, then as a substring: "KeyStep" finds "Arturia KeyStep 37". If several ports match, the first wins. optional = true is for a controller you don’t always have plugged in. midi_input_ports() lists what the system offers:

print(midi_input_ports());

Route the input into a track, turn monitoring on, and route the track’s output:

let keys = MidiTrack("keys")
.set_input("kb")
.set_monitor(Monitor.input);
keys >> MidiOutput("synth");

What you play on the keyboard comes out of the "synth" port, on the output’s channel. Declare that port as in Send MIDI to a Synth or DAW. A track with no output has nowhere to send its input, so nothing comes through until the >> line runs.

Add a channel to take only that channel from the port. Use "all" to take every connected input:

let bass = MidiTrack("bass").set_input("kb", 1); // channel 1 of "kb" only
let omni = MidiTrack("omni").set_input("all"); // every input port

A track has one input. Calling .set_input() again replaces it.

Set the monitor back to Monitor.off, the default:

let keys = MidiTrack("keys").set_input("kb");
keys.set_monitor(Monitor.off);
ModeWhat reaches the output
Monitor.offNothing from the input
Monitor.inputEverything from the input
Monitor.autoEverything from the input while the transport is stopped or the track has no pattern; nothing while the track plays its pattern
midi_input_disconnect("kb");

Tracks that were playing it through get an all-notes-off, so nothing hangs.