ESP32, MIDI over USB

Hi,
I have some trouble with my MIDI drum machine and DAW/plugin on my laptop. I have and ESP32 S3 board handy and I thought I could quickly whip up a little sketch that generares a MIDI note every few seconds. Boy, was I disappointed. Every how-to or YT tutorial I find libraties or Github pages I cannot find (anymore). Could anyone be so nice as to point me in the direction of a simple current example I can butcher to generate a MIDI note over USB from my ESP32 board to my computer's DAW?

Cheers,

Hugo

What about this

The Control Surface library supports MIDI over USB on the ESP32-S3:

1 Like

Thank you, both. I went with PieterP's suggestion, installed the control surface library (via ZIP file from github, does it make sense it is not found in the library manager?). Next, I copied the simple example sketch that sends one MIDI note every second. As that is exactly what I need. I verified the sketch and it comes back with these messages:

In file included from c:\Users\hugow\Documents\Arduino\libraries\Control_Surface\src/MIDI_Interfaces/USBMIDI_Interface.hpp:4,
                 from c:\Users\hugow\Documents\Arduino\libraries\Control_Surface\src/Control_Surface.h:129,
                 from C:\Users\hugow\AppData\Local\Temp\.arduinoIDE-unsaved202544-18780-18slvx6.xm8x\sketch_may4a\sketch_may4a.ino:1:
c:\Users\hugow\Documents\Arduino\libraries\Control_Surface\src/MIDI_Interfaces/USBMIDI/USBMIDI.hpp:96:103: note: '#pragma message: ESP32-S2/S3: USB MIDI not enabled. Set the Tools > USB Type setting to "USB-OTG" to enable it.'
   96 |     "ESP32-S2/S3: USB MIDI not enabled. Set the Tools > USB Type setting to \"USB-OTG\" to enable it.")
      |                                                                                                       ^
Sketch uses 389022 bytes (29%) of program storage space. Maximum is 1310720 bytes.
Global variables use 21740 bytes (6%) of dynamic memory, leaving 305940 bytes for local variables. Maximum is 327680 bytes.

I don't understand these, and I am especially baffled by this instruction:
"ESP32-S2/S3: USB MIDI not enabled. Set the Tools > USB Type setting to "USB-OTG" to enable it."
Because when I go to Tools, there is no USB type setting.

Please explain to me what I am doing wrong. The board is recognised by the IDE and I can write the blink sketch to it, so I think the board and connection are OK.

Cheers,

Hugo

The setting you need is called USB Mode = USB-OTG (TinyUSB):

Oh, my bad, I didn't see it in the list of choices; I missed there was an arrow down for more option. The sketch verified and uploaded without a hitch, now. Unfortunately, the board is not recognised by the laptop as a MIDI device, yet, when I connect the USB port of the ESP32 S3 to the computer. I can find it as a USB device called TinyUSB MIDI, but in various programs it is not recognised as a MIDI device. I'm diving in the tutorial again.

[EDIT]I found the setting, it works now. Thanks! [/EDIT]

Cheers,

Hugo

Hey Hugo,
Have you implemented the Control Surface in your program later on?
I am experiencing the same issue with my newly made DIY E-Drum. My PC is not recognizing the ESP32 S3 as a MIDI device; however, i have checked all the USB settings.

Which version of Control Surface are you using? And which version of the arduino-esp32 core?