Releases: leandrodaf/midi
v2.3.0 — WatchDevices hot-plug detection
What's new
feat: WatchDevices — MIDI device hot-plug detection
WatchDevices(ctx) (<-chan DeviceEvent, error)added toClientMIDIinterface- Linux: uses udev via netlink to detect device add/remove events natively
- macOS: uses CoreMIDI notification callback (zero polling)
- Windows: polls
midiInGetNumDevsevery 2 s and diffs against previous list DeviceEvent{Type, Device}withDeviceAdded/DeviceRemovedconstants
Bug fixes
- Windows:
stopCapture()function body was floating outside any function declaration — syntax error on Windows CI build - macOS:
cgo.Handlehas noPointer()method; replaced withunsafe.Pointer(uintptr(h))
v2.1.0 - Native Linux MIDI support (ALSA)
What's new
🐧 Native Linux MIDI support via ALSA
Linux is now a fully supported platform alongside macOS and Windows. MIDI events are captured using the ALSA snd_rawmidi API — no external Go libraries, only the standard system header libasound2-dev.
Requirements on Linux:
apt-get install libasound2-dev # build-time onlyCGO_ENABLED=1 (the default) is required. If you build with CGO_ENABLED=0, the client compiles but all methods return ErrCGORequired.
Install:
go get github.com/leandrodaf/midi/v2@v2.1.0Implementation highlights
- Device enumeration iterates sound cards via
snd_card_next+snd_ctl_rawmidi_next_device, covering all hardware and USB MIDI ports - Read loop uses
unix.Pollon both the ALSA file descriptor and a cancel pipe —Stop()wakes the goroutine immediately with no busy-waiting - Full MIDI byte parser with running-status support and SysEx skip
- Same context-based lifecycle as the macOS client
CI
All three platforms (macOS, Windows, Linux) now run with CGO_ENABLED=1 and the race detector enabled.
v2.0.2 - Fix Go module path
Bug Fix
🔴 Critical: Go module path corrected
v2.0.0 and v2.0.1 were tagged but the go.mod still declared module github.com/leandrodaf/midi (without /v2). This violated Go module semantics and caused go get to silently resolve to v1 instead of v2, breaking everyone who tried to use the new API.
What changed
go.mod:module github.com/leandrodaf/midi/v2- All internal imports updated to
github.com/leandrodaf/midi/v2/...
Migration from v2.0.0 / v2.0.1
go get github.com/leandrodaf/midi/v2@v2.0.2Update your imports:
import (
"github.com/leandrodaf/midi/v2/sdk/midi"
"github.com/leandrodaf/midi/v2/sdk/contracts"
"github.com/leandrodaf/midi/v2/sdk/logger"
)v2.0.1 — dependency cleanup, Go 1.26, and docs fix
What's Changed
Bug fix
sdk/loggerpackage exposed — the example and README incorrectly referencedinternal/logger, which external consumers cannot import. A newsdk/loggerpackage now re-exportsNewLogger()as the proper public entrypoint.
Dependency cleanup
- Removed
github.com/youpy/go-coremidi— CoreMIDI is now implemented natively ininternal/coremidi/via CGo, with no third-party wrapper. - Removed
go.uber.org/zapandgo.uber.org/multierr— the logger was rewritten without any external dependencies. - Only remaining dependency:
golang.org/x/sys v0.44.0(Windowswinmm.dllsyscalls).
Maintenance
- Upgraded to Go 1.26.
- Updated
golang.org/x/sysfromv0.26.0tov0.44.0.
Documentation
- README rewritten: correct imports (
sdk/loggerinstead ofinternal/logger), options table with defaults, filtering section, custom logger interface example,MockMIDIClientusage, and platform notes table.
Full Changelog: v2.0.0...v2.0.1