|
1 | 1 | # ESP32-S2 and ESP32-S3 USB MIDI Example for Arduino
|
2 | 2 |
|
| 3 | +For lots more debug output, set the Debug Core Level to Verbose. This can |
| 4 | +drastically slow the code so do not do this when speed matters. |
| 5 | + |
| 6 | +## examples/ESP32USBMIDI |
| 7 | + |
3 | 8 | This program is based on an ESP-IDF TinyUSB USB MIDI example with minimal
|
4 | 9 | changes so it works with arduino-esp32. See https://github.com/espressif/esp-idf/blob/master/examples/peripherals/usb/device/tusb_midi/main/tusb_midi_main.c
|
5 | 10 | for the original code.
|
6 | 11 |
|
7 | 12 | The board must be reset or power cycled to make the new code take effect. This
|
8 |
| -has been tested on ESP32-S3 and ESP32-S2 DevKit boards ("ESP32S3 Dev Module" |
| 13 | +has been tested on ESP32S3 and ESP32S2 DevKit boards ("ESP32S3 Dev Module" |
9 | 14 | and "ESP32S2 Dev Module").
|
10 | 15 |
|
11 | 16 | USB Mode must be set to USB-OTG (TinyUSB) on ESP32S3.
|
12 | 17 |
|
13 |
| -For lots more debug output, set the Debug Core Level to Verbose. It helps to be |
14 |
| -familiar with the ESP-IDF API. |
| 18 | +Some knowledge of the ESP-IDF API is helpful to understand the code. |
15 | 19 |
|
16 | 20 | Example of output on the Arduino IDE Serial monitor.
|
17 | 21 | The computer connected to the ESP32S3 sends MIDI Start, Stop, and CC 7 0.
|
@@ -41,3 +45,53 @@ channel 1 note-off A4 0
|
41 | 45 | channel 1 note-on F#5 127
|
42 | 46 | channel 1 note-off D5 0
|
43 | 47 | ```
|
| 48 | + |
| 49 | +## examples/ESP32USBMIDIECHO |
| 50 | + |
| 51 | +This program echos USB MIDI back to the source. There is very little serial console output. |
| 52 | + |
| 53 | +SendMIDI and ReceiveMIDI are command line MIDI programs for Windows, MacOS, and Linux. |
| 54 | + |
| 55 | +* https://github.com/gbevin/ReceiveMIDI |
| 56 | +* https://github.com/gbevin/SendMIDI |
| 57 | + |
| 58 | +In one terminal windows, get ready to show received MIDI with timestamps. |
| 59 | +``` |
| 60 | +$ receivemidi list |
| 61 | +Midi Through Port-0 |
| 62 | +ESP32S3_DEV MIDI 1 |
| 63 | +$ receivemidi dev ESP32S3_DEV timestamp |
| 64 | +``` |
| 65 | + |
| 66 | +In another terminal window, send MIDI start and stop. |
| 67 | +``` |
| 68 | +$ sendmidi list |
| 69 | +Midi Through Port-0 |
| 70 | +ESP32S3_DEV MIDI 1 |
| 71 | +$ sendmidi dev ESP32S3_DEV start stop |
| 72 | +``` |
| 73 | + |
| 74 | +On the receive window, something similar to this should appear. |
| 75 | +``` |
| 76 | +13:18:25.506 stop |
| 77 | +13:18:25.507 start |
| 78 | +``` |
| 79 | + |
| 80 | +Try sending MIDI panic to see what it does. |
| 81 | +``` |
| 82 | +$ sendmidi dev ESP32S3_DEV panic |
| 83 | +``` |
| 84 | + |
| 85 | +panic sends note off to all 16 channels and for all 128 notes plus CC 64 0, CC 120, 0, and CC 123 0. |
| 86 | + |
| 87 | +receivemidi should show something like this. This is the start of a very long |
| 88 | +listing. |
| 89 | +``` |
| 90 | +13:22:32.791 channel 1 control-change 64 0 |
| 91 | +13:22:32.792 channel 1 control-change 120 0 |
| 92 | +13:22:32.793 channel 1 control-change 123 0 |
| 93 | +13:22:32.794 channel 1 note-off C-2 0 |
| 94 | +13:22:32.795 channel 1 note-off C#-2 0 |
| 95 | +13:22:32.796 channel 1 note-off D-2 0 |
| 96 | +13:22:32.797 channel 1 note-off D#-2 0 |
| 97 | +``` |
0 commit comments