Skip to content

Commit 5aad63f

Browse files
committed
Add MIDI echo example to the README.md
1 parent c55246d commit 5aad63f

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed

README.md

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# ESP32-S2 and ESP32-S3 USB MIDI Example for Arduino
22

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+
38
This program is based on an ESP-IDF TinyUSB USB MIDI example with minimal
49
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
510
for the original code.
611

712
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"
914
and "ESP32S2 Dev Module").
1015

1116
USB Mode must be set to USB-OTG (TinyUSB) on ESP32S3.
1217

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.
1519

1620
Example of output on the Arduino IDE Serial monitor.
1721
The computer connected to the ESP32S3 sends MIDI Start, Stop, and CC 7 0.
@@ -41,3 +45,53 @@ channel 1 note-off A4 0
4145
channel 1 note-on F#5 127
4246
channel 1 note-off D5 0
4347
```
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+
```

examples/ESP32USBMIDIECHO/ESP32USBMIDIECHO.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void setup() {
9292
USB.begin();
9393
while (!Serial && millis() < 5000)
9494
delay(10);
95-
// Read recieved MIDI packets then write them out
95+
// Read received MIDI packets then write them out
9696
ESP_LOGI(TAG, "MIDI echo task");
9797
xTaskCreate(midi_echo, "midi_echo", 2 * 1024, NULL, 5, NULL);
9898
}

0 commit comments

Comments
 (0)