Skip to content
Simple stream-based MIDI message encoder and decoder written in C.
C C++
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Nanomidi is a simple stream-based MIDI message encoder and decoder written in C. It is suitable for embedded (microcontroller) applications.

For more information, see API documentation (generated by Doxygen) or examples.



  • Message encoder midi_encode()
  • Message decoder midi_decode() with support for Running Status (omitted status byte in successive messages of the same type)
  • Data structures for Channel Mode Messages (Note On, Control Change, etc.) and System Common Messages
  • Support for System Real Time Messages (single-byte messages which can occur anywhere in the stream)
  • Support for System Exclusive Messages (SysEx)
  • Support for USB MIDI packet format (midi_encode_usb() and midi_decode_usb()) described in Universal Serial Bus Device Class Definition for MIDI Devices


To build examples, simply run make in the examples directory.

Example example-libusb requires libusb. On Ubuntu, install it using

sudo apt-get install libusb-1.0-0-dev

Arduino library

To use Nanomidi as an Arduino library, simply download it into the usual library location:

cd ~/Arduino/libraries
git clone

Then, include Nanomidi using #include <nanomidi_arduino.h>. See examples/encode_arduino for example usage.


Nanomidi is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

See file COPYING for details.

You can’t perform that action at this time.