Skip to content

MIDI Monitor

App: apps/midi_input_demo/

A MIDI monitor (engine PLM-135 / ADR 0044): it lists the MIDI input devices with Midi.inputDevices, opens the first one, and shows the incoming events — notes, controllers, pitch bend — scrolling in a GUI window. Plug in a USB-MIDI keyboard and play.

Desktop only. With no device connected it shows a hint instead; the events can drive anything (feeding them to a SoundFontInstrument is the next step).

Terminal window
% ./plume3d midi_input_demo
  • On init, reads Midi.inputDevices; if any exist, opens device 0 with Midi.openInput(0) and logs the opened device name.
  • Each update, drains Midi.poll() and formats each event (note on/off, control change, pitch bend, …) into a scrolling log shown in a Gui window.
  • On quit, calls Midi.closeInput().
import "engine" for Midi
// init: open the first available MIDI input.
if (Midi.inputDevices.count > 0) Midi.openInput(0)
// update: consume this frame's events (drained onto the main thread by the engine).
for (ev in Midi.poll()) {
if (ev["type"] == "noteOn") {
// ev["data1"] = note, ev["data2"] = velocity, ev["channel"] = 0..15
}
}
  • MidiinputDevices, openInput, closeInput, isOpen, openedDevice, poll.
  • Gui — the monitor window.
  • Logger — reports the opened device / “no devices found”.