Code Monkey home page Code Monkey logo

libmidi's Introduction

libmidi

The goal of the libmidi project is to provide a high-quality MIDI software implementation that is suitable for use on microcontrollers.

Initially, the PIC18 family of microcontrollers will be supported using the Microchip (TM) XC8 compiler. A Makefile is provided for that environment.

This library is ALPHA; it has not been thoroughly reviewed or tested at this time.

Building

git clone https://github.com/mikromodular/libmidi
cd libmidi
make

This assumes that the Microchip XC8 compiler suite is installed on your system. Installing this software is beyond the scope of this README. Please see http://www.microchip.com/mplab/compilers for more details.

Priciples of Operation

The libmidi library employs a callback scheme in which the user registers callback functions to handle only the events that they are interested in. Events for which no handlers are registered will be processed silently by the library.

The callback mechanism is "driven" by invocations of the midi_receive_byte() function, which must be called once for every single byte received from the UART that is configure to read MIDI events. All protocol state is managed by the library.

This design is flexible because it allows the programmer to use it in a polling loop or in an interrupt handler. It should be noted, however, that use within an interrupt handler has not been tested at all, and the author is not yet familiar with this use case. If you're interested in using this library from an interrupt handler, please contact the author so that we can discuss incorporating any changes that might be necessary.

API Lifecycle

The following list outlines the steps, in order, that the programmer must take to use the library.

  1. Call midi_init() to perform one-time initializaton of globals.
  2. Call midi_register_event_handler() to register callbacks for events (note on, note off, etc.)
  3. Call midi_receive_byte() once for every byte received on the UART device. Calling this function "drives" the event dispatch system and may result in callback invocation.

Implementation Notes

  • Note On/Off Some devices do not seem to send note off messages. Rather, they send note on messages with a velocity of zero. Your application should probably account for this by checking for this condition and delegating to your note off handler.

Current Status

This library is currently in ALPHA.

Testing

There are no unit tests at this time. Unit tests are planned; they will likely be developed to compile and run locally on the development system and will be executed as part of the continuous integration process once a system has been chosen.

Examples

A simple example of MIDI processing is forthcoming.

Contact

Please see AUTHORS in the root of the repository for contact information.

Dependencies

None

Future Planned Development

  • MIDI Transmission (Only receive is supported at this time.)
  • Support for multiple MIDI ports (only one in and one out will be supported as part of the first official release.)

libmidi's People

Contributors

dialtr avatar mikromodular avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

libmidi's Issues

Poliphony is not supported

Hi,
is my impression or if you receive a note on message the library wait for a note off?

Thanks,
Nick

g_message_counter is incremented twice for the ignored event

If no callback is being registered for the specific event type, null_event_cb() is called, which increments the g_message_counter. However this counter is already incremented in the invoke_callback() that calls it. As a result g_message_counter is incremented twice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.