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.
Declare an input port
Section titled “Declare an input port”Add a [[midi.inputs]] entry to ~/.resonon/preferences.toml and run reload_preferences():
[[midi.inputs]]alias = "kb"port = "KeyStep"optional = trueThe 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());Play a synth from the keyboard
Section titled “Play a synth from the keyboard”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.
Listen to one channel, or every port
Section titled “Listen to one channel, or every port”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" onlylet omni = MidiTrack("omni").set_input("all"); // every input portA track has one input. Calling .set_input() again replaces it.
Stop hearing the input
Section titled “Stop hearing the input”Set the monitor back to "off", the default:
let keys = MidiTrack("keys").set_input("kb");keys.set_monitor("off");| Mode | What reaches the output |
|---|---|
"off" | Nothing from the input |
"in" | Everything from the input |
"auto" | Currently the same as "in" |
Disconnect the keyboard
Section titled “Disconnect the keyboard”midi_input_disconnect("kb");Tracks that were playing it through get an all-notes-off, so nothing hangs.
Related
Section titled “Related”- Map a Controller — use knobs and faders as signals
- Monitoring & Thru — channel remapping and feedback protection
- Preferences — every port key