|
5 | 5 | [](https://github.com/FortySevenEffects/arduino_midi_library/releases/latest)
|
6 | 6 | [](LICENSE)
|
7 | 7 |
|
8 |
| -This library enables MIDI I/O communications on the Arduino serial ports. |
| 8 | +This library adds MIDI I/O communications to an Arduino board. |
9 | 9 |
|
10 | 10 | ### Features
|
11 |
| -* Compatible with all Arduino boards (and clones with an AVR processor). |
12 |
| -* Simple and fast way to send and receive every kind of MIDI message (including all System messages, SysEx, Clock, etc..). |
13 |
| -* OMNI input reading (read all channels). |
14 |
| -* Software Thru, with message filtering. |
15 |
| -* [Callbacks](http://playground.arduino.cc/Main/MIDILibraryCallbacks) to handle input messages more easily. |
16 |
| -* Last received message is saved until a new one arrives. |
17 |
| -* Configurable: [overridable template-based settings](https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-custom-Settings). |
18 |
| -* Create more than one MIDI port for mergers/splitters applications. |
19 |
| -* Use any serial port, hardware or software. |
| 11 | + |
| 12 | +- **New** : USB MIDI Device support with [`MIDIUSB`](https://github.com/arduino-libraries/MIDIUSB). |
| 13 | +- Compatible with all Arduino boards (and clones with an AVR processor). |
| 14 | +- Simple and fast way to send and receive every kind of MIDI message (including all System messages, SysEx, Clock, etc..). |
| 15 | +- OMNI input reading (read all channels). |
| 16 | +- Software Thru, with message filtering. |
| 17 | +- [Callbacks](https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-Callbacks) to handle input messages more easily. |
| 18 | +- Last received message is saved until a new one arrives. |
| 19 | +- Configurable: [overridable template-based settings](https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-custom-Settings). |
| 20 | +- Create more than one MIDI interface for mergers/splitters applications. |
| 21 | +- Use any serial port, hardware or software. |
20 | 22 |
|
21 | 23 | ### Getting Started
|
22 | 24 |
|
23 |
| -1. Use Arduino's Library Manager to install the library. |
24 |
| - |
| 25 | +1. Use the Arduino Library Manager to install the library. |
| 26 | +  |
25 | 27 |
|
26 | 28 | 2. Start coding:
|
27 |
| - ```c++ |
28 |
| - #include <MIDI.h> |
29 | 29 |
|
30 |
| - // Created and binds the MIDI interface to the default hardware Serial port |
31 |
| - MIDI_CREATE_DEFAULT_INSTANCE(); |
| 30 | +```c++ |
| 31 | +#include <MIDI.h> |
| 32 | + |
| 33 | +// Create and bind the MIDI interface to the default hardware Serial port |
| 34 | +MIDI_CREATE_DEFAULT_INSTANCE(); |
32 | 35 |
|
33 |
| - void setup() |
34 |
| - { |
35 |
| - MIDI.begin(MIDI_CHANNEL_OMNI); // Listen to all incoming messages |
36 |
| - } |
| 36 | +void setup() |
| 37 | +{ |
| 38 | + MIDI.begin(MIDI_CHANNEL_OMNI); // Listen to all incoming messages |
| 39 | +} |
37 | 40 |
|
38 |
| - void loop() |
39 |
| - { |
40 |
| - // Send note 42 with velocity 127 on channel 1 |
41 |
| - MIDI.sendNoteOn(42, 127, 1); |
| 41 | +void loop() |
| 42 | +{ |
| 43 | + // Send note 42 with velocity 127 on channel 1 |
| 44 | + MIDI.sendNoteOn(42, 127, 1); |
42 | 45 |
|
43 |
| - // Read incoming messages |
44 |
| - MIDI.read(); |
45 |
| - } |
46 |
| - ``` |
| 46 | + // Read incoming messages |
| 47 | + MIDI.read(); |
| 48 | +} |
| 49 | +``` |
47 | 50 |
|
48 | 51 | 3. Read the [documentation](#documentation) or watch the awesome video tutorials from [Notes & Volts](https://www.youtube.com/playlist?list=PL4_gPbvyebyH2xfPXePHtx8gK5zPBrVkg).
|
49 | 52 |
|
50 | 53 | ## Documentation
|
51 | 54 |
|
52 |
| -- [Doxygen Extended Documentation](http://fortyseveneffects.github.io/arduino_midi_library/). |
53 |
| -- [GitHub wiki](https://github.com/FortySevenEffects/arduino_midi_library/wiki). |
| 55 | +- [Doxygen Extended Documentation](https://fortyseveneffects.github.io/arduino_midi_library/). |
| 56 | +- [GitHub wiki](https://github.com/FortySevenEffects/arduino_midi_library/wiki). |
| 57 | + |
| 58 | +## USB Migration (4.x to 5.x) |
| 59 | + |
| 60 | +All USB related code has been moved into a separate repository [Arduino-USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI), USB MIDI Device support with [`MIDIUSB`](https://github.com/arduino-libraries/MIDIUSB), still using this library to do all the MIDI heavy-lifting. |
| 61 | + |
| 62 | +Migration has been made as easy as possible: only the declaration of the MIDI object has been modified, the rest of your code remains identical. |
| 63 | + |
| 64 | +`4.3.1` code: |
| 65 | + |
| 66 | +```c++ |
| 67 | +#include <MIDI.h> |
| 68 | +#include <midi_UsbTransport.h> |
| 69 | + |
| 70 | +static const unsigned sUsbTransportBufferSize = 16; |
| 71 | +typedef midi::UsbTransport<sUsbTransportBufferSize> UsbTransport; |
| 72 | + |
| 73 | +UsbTransport sUsbTransport; |
| 74 | + |
| 75 | +MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, MIDI); |
| 76 | + |
| 77 | +// ... |
| 78 | +``` |
| 79 | +
|
| 80 | +now becomes in `5.0.0`: |
| 81 | +
|
| 82 | +```c++ |
| 83 | +#include <USB-MIDI.h> |
| 84 | +USBMIDI_CREATE_DEFAULT_INSTANCE(); |
| 85 | +
|
| 86 | +// ... |
| 87 | +``` |
| 88 | + |
| 89 | +Start with the [NoteOnOffEverySec](https://github.com/lathoub/Arduino-USBMIDI/blob/master/examples/NoteOnOffEverySec/NoteOnOffEverySec.ino) example that is based on the original MidiUSB [sketch](https://github.com/lathoub/arduino_midi_library/blob/master/examples/MidiUSB/MidiUSB.ino). Note the only difference is in the declaration. |
| 90 | + |
| 91 | +The [USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI) Arduino library depends on [this library](https://github.com/FortySevenEffects/arduino_midi_library) and the [MIDIUSB](https://github.com/arduino-libraries/MIDIUSB) library. |
| 92 | + |
| 93 | +[USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI) uses the latest Arduino IDE `depends` feature in the `library.properties` file installing all the dependencies automatically when installing from the IDE. |
| 94 | + |
| 95 | +## Other Transport mechanisms |
| 96 | + |
| 97 | +Version 5 of this library, allows for other Transport layers than the |
| 98 | +original MIDI 1.0 Electrical Specification (hardware serial). |
| 99 | + |
| 100 | +- [USB-MIDI](https://github.com/lathoub/Arduino-USBMIDI) |
| 101 | +- [AppleMIDI or rtpMIDI](https://github.com/lathoub/Arduino-AppleMIDI-Library) |
| 102 | +- [ipMIDI](https://github.com/lathoub/Arduino-ipMIDI) |
| 103 | +- [BLE-MIDI](https://github.com/lathoub/Arduino-BLE-MIDI) |
| 104 | + |
| 105 | +All these Transport layers use this library for all the underlying MIDI |
| 106 | +work, making it easy to switch transport protocols or making transport |
| 107 | +protocol bridges. |
54 | 108 |
|
55 | 109 | ## Contact
|
56 | 110 |
|
57 | 111 | To report a bug, contribute, discuss on usage, or simply request support, please [create an issue here](https://github.com/FortySevenEffects/arduino_midi_library/issues/new).
|
58 | 112 |
|
59 |
| -You can also get informations about bug fixes and updates on my twitter account: [@fortysevenfx](http://twitter.com/fortysevenfx). |
| 113 | +You can also contact me on Twitter: [@fortysevenfx](https://twitter.com/fortysevenfx). |
60 | 114 |
|
61 | 115 | ## License
|
62 | 116 |
|
63 |
| -MIT © 2016 [Francois Best](http://fortyseveneffects.com) |
| 117 | +MIT © 2009 - present [Francois Best](https://francoisbest.com) |
0 commit comments