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("in");
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 "off", the default:

let keys = MidiTrack("keys").set_input("kb");
keys.set_monitor("off");
ModeWhat reaches the output
"off"Nothing from the input
"in"Everything from the input
"auto"Currently the same as "in"
midi_input_disconnect("kb");

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