Categorygithub.com/gomidi/midi
modulepackage
0.8.2
Repository: https://github.com/gomidi/midi.git
Documentation: pkg.go.dev

# README

midi

Reading and writing of MIDI messages with Go.

Build Status Travis/Linux Build Status AppVeyor/Windows Coverage Status Go Report

Goals

  • implementation of complete MIDI standard (live and SMF data)
  • provide building blocks for MIDI applications
  • stable API
  • no dependencies outside the standard library
  • small modular core packages and a fat comfortable porcelain package
  • pure Go library (no C, no assembler)

Non-Goals

Usage

Most users will want to use the porcelain package

go get -d -t github.com/gomidi/midi/mid

Docs: Documentation

You don't need to read here further, if you are not interested in the nitty gritty details.

Modularity

This package is divided into small subpackages, so that you only need to import what you really need. This keeps packages and dependencies small, better testable and should result in a smaller memory footprint which should help smaller devices.

For reading and writing of live and SMF MIDI data io.Readers are accepted as input and io.Writers as output. Furthermore there are common interfaces for live and SMF MIDI data handling: midi.Reader and midi.Writer. The typed MIDI messages used in each case are the same.

Perfomance

On my laptop, writing noteon and noteoff ("live")

BenchmarkSameChannel            123 ns/op  12 B/op  3 allocs/op
BenchmarkAlternatingChannel     123 ns/op  12 B/op  3 allocs/op
BenchmarkRunningStatusDisabled  110 ns/op  12 B/op  3 allocs/op

On my laptop, reading noteon and noteoff ("live") ("Samechannel" makes use of running status byte).

BenchmarkSameChannel            351 ns/op  12 B/op  7 allocs/op
BenchmarkAlternatingChannel     425 ns/op  14 B/op  9 allocs/op

Full Documentation

see http://godoc.org/github.com/gomidi/midi

Status

late beta - API mostly stable

  • Supported Go versions: >= 1.2
  • Supported OS/architecture: Should work on all OS/architectures that Go supports (is tested on Linux and Windows, but no OS specific code).
    package                   API stable          complete
    ----------------------------------------------------
    midiwriter                yes                 yes
    midireader                yes                 yes
    smf                       yes                 yes
    smf/smfwriter             yes                 yes
    smf/smfreader             yes                 yes
    midimessage/channel       yes                 yes
    midimessage/cc            yes                 yes
    midimessage/meta          yes                 yes
    midimessage/realtime      yes                 yes
    midimessage/syscommon     yes                 yes
    midimessage/sysex         no                  yes
    midiio                    yes                 yes
    
	------- porcelain packages -------
    smf/smftrack              no                  no
    mid                       almost              yes

License

MIT (see LICENSE file)

Credits

Inspiration and low level code for MIDI reading (see internal midilib package) came from the http://github.com/afandian/go-midi package of Joe Wass which also helped as a starting point for the reading of SMF files.

Alternatives

Matt Aimonetti is also working on MIDI inside https://github.com/mattetti/audio but I didn't try it.

# Packages

Package mid provides an easy abstraction for reading and writing of MIDI data live or from SMF files.
Package midiio provides helpers for converting between io.Readers and io.Writers and midi.Readers and midi.Writers.
Package midimessage provides helper functions for MIDI messages.
Package midireader provides a reader for live/streaming/"over the wire" MIDI data.
Package midiwriter provides a writer for live/streaming/"over the wire" MIDI data.
Package smf provides constants and interfaces for reading and writing of Standard MIDI Files (SMF).

# Variables

# Interfaces

Message is a MIDI message.
ReadCloser is a Reader that must be closed at the end of reading.
Reader reads MIDI messages.
WriteCloser is a Writer that must be closed at the end of writing.
Writer writes MIDI messages.