// the find
rakyll/portmidi
Go bindings for libportmidi
Go bindings for PortMidi, giving you basic MIDI I/O: enumerate devices, write note events to an output stream, and read events from an input stream via polling or a channel. It's for anyone building a small MIDI tool or synth controller in Go who doesn't want to write cgo against libportmidi themselves.
The API surface is thin and maps almost 1:1 onto PortMidi's C functions, so if you already know PortMidi there's nothing new to learn. Channel masking is exposed directly (SetChannelMask), which most beginner MIDI wrappers skip. The Listen() channel-based read is a nice ergonomic addition over the raw polling Read() call, useful for event-loop style consumers.
No commits since March 2022 and only 290 stars/54 forks — this is effectively unmaintained, so don't expect fixes for newer Go versions or libportmidi ABI changes. It's a cgo wrapper requiring libportmidi v217 specifically installed system-side, which breaks CGO_ENABLED=0 builds, cross-compilation, and Docker multi-stage images without extra apt-get/brew steps baked in. Error handling on the read path just returns a Go error with no distinction between device disconnects, buffer overruns, or malformed data, so recovery logic has to guess. There's a single example_test.go and no real unit tests, so behavior around edge cases like a MIDI device unplugged mid-stream is undocumented and untested.