Reference Language | Libraries | Comparison | Changes
These library allows any microcontroller with native USB capabilities (atmega32u4 based boards or ARM boards) to appear as a MIDI peripheral over USB to a connected computer.
The library is compatible with PluggableUSB-ready cores (AVR core > 1.6.8, SAM core > 1.6.4, SAMD core > 1.6.1)
The library exposes the following functions
midiEventPacket_t read(void);
void sendMIDI(midiEventPacket_t event);
void flush(void);
This functions reads data from the USB and packages it into a MIDI packet (midiEventPacket_t struct
). For example, you can use this function to act as a MIDI IN device, getting notes from the PC and transforming them into audible music.
Using this function you will send a MIDI encoded packet to the PC. You can use it to produce music by reading inputs and transfer the encoded data to a software synth.
This function forces the USB layer to send the data immediately. Since the USB bus is not realtime, a sendMIDI()
doesn't guarantee the data to be sent with the correct timing unless immediately followed by a flush()
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.