Sean Luke
December 1, 2024
This is not a GRAINS project, though it is used in several projects. It is a low-footprint MIDI emitting and parsing library meant for small microprocessors, and contains additional features for the Modular MIDI conventions. It's currently under development.
For more info on Modular MIDI, see Modular MIDI Conventions for Developers.
The library can be used to (1) emit MIDI (2) parse MIDI or (3) do both.
Include the following files in your project:
- parsemidi.h
- parsemidi.c
- miditypes.h
Modify the miditypes.h file so that its signed and unsigned 16-bit integer type sizes are correct. By default it has types set up for the ATmega 328P chip family (Arduino series).
Next, you'll need to modify the parsemidi.h file as described in that file, and write callback functions in your project for the midi types you've asked it to parse.
See the parsemidi.h file for instructions on how to build and use a MIDI parser.
Include the following files in your project:
- emitmidi.h
- emitmidi.c
- miditypes.h
Modify the miditypes.h file so that its signed and unsigned 16-bit integer type sizes are correct. By default it has types set up for the ATmega 328P chip family (Arduino series).
See the emitmidi.h file for instructions on how to build and use a MIDI emitter.
Include the following files in your project:
- emitmidi.h
- emitmidi.c
- parsemidi.h
- parsemidi.c
- miditypes.h
- testmidi.c
Modify the miditypes.h file so that its signed and unsigned 16-bit integer type sizes are correct. By default it has types set up for the ATmega 328P chip family (Arduino series).
The testmidi.c file has a main(). Compile and run it:
gcc testmidi.c
./a.out
Include the following files in your project:
- utilities.h
- utilities.c
These are utility functions that may be of use to you. They include:
- Pitch bend calculations
- Conversions from pitch to frequency with all integer math
- Note distribution and voice allocation tools
Note that the utilities are at present ENTIRELY UNTESTED.
The Modular MIDI Conventions are a set of conventions for implementing MIDI between modules in a modular synthesizer. If you don't care about that, this section is not relevant to you.
Set up a MIDI Parser. See "Parsing MIDI" above.
Include the following additional files in your project:
- parsemodular.h
- parsemodular.c
The MIDI parsing facility is just a bunch of utility functions to make things easier for you. See the parsemodular.h file for instructions on how to use them.
The Modular MIDI Conventions are a set of conventions for implementing MIDI between modules in a modular synthesizer. If you don't care about that, this section is not relevant to you.
Set up a MIDI Emitter. See "emitting MIDI" above.
Include the following additional files in your project:
- emitmodular.h
- emitmodular.c
The MIDI emitting facility is just a bunch of utility functions to make things easier for you. See the emitmodular.h file for instructions on how to use them.
At present there is no test code for testing the Modular MIDI conventions emitting and parsing utilities.