ESP32 Bluetooth MIDI: Libraries not found despite being installed

I am working on an ESP32 Bluetooth MIDI project and have installed all the necessary libraries, but I keep getting error messages indicating that the libraries aren't being found. Does anyone know what might be causing this?

I'm trying to run this example from ESP32-BLE-Midi

#include <Arduino.h>
#include <BLEMidi.h>

void setup() {
  Serial.begin(115200);
  Serial.println("Initializing bluetooth");
  BLEMidiServer.begin("Basic MIDI device");
  Serial.println("Waiting for connections...");
  //BLEMidiServer.enableDebugging();  // Uncomment if you want to see some debugging output from the library (not much for the server class...)
}

void loop() {
  if(BLEMidiServer.isConnected()) {             // If we've got a connection, we send an A4 during one second, at full velocity (127)
      BLEMidiServer.noteOn(0, 69, 127);
      delay(1000);
      BLEMidiServer.noteOff(0, 69, 127);        // Then we make a delay of one second before returning to the beginning of the loop
      delay(1000);
  }
}

but it always gives me this error

In file included from /Users/benjaminlau/Documents/Arduino/libraries/ESP32-BLE-MIDI/src/BLEMidi.h:4,
                 from /private/var/folders/kf/lpkfwt8n3l15yq212gxxn5jw0000gn/T/.arduinoIDE-unsaved2025016-54257-el64j3.spkq/01-Basic-Midi-Device/01-Basic-Midi-Device.ino:2:
/Users/benjaminlau/Documents/Arduino/libraries/ESP32-BLE-MIDI/src/utility/BLEMidiServer.h:18:10: error: 'void BLEMidiServerClass::onConnect(NimBLEServer*)' marked 'override', but does not override
   18 |     void onConnect(BLEServer* pServer) override;
      |          ^~~~~~~~~
/Users/benjaminlau/Documents/Arduino/libraries/ESP32-BLE-MIDI/src/utility/BLEMidiServer.h:19:10: error: 'void BLEMidiServerClass::onDisconnect(NimBLEServer*)' marked 'override', but does not override
   19 |     void onDisconnect(BLEServer* pServer) override;
      |          ^~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

Looks like this has been logged as an issue on the library Github page:

1 Like

If ESP32-BLE-MIDI isn't working for you, it may be worth looking at the Control Surface library I maintain: Control Surface: BLEMIDI-Adapter.ino

Hi @benjamino. I see from the issue report @BitSeeker shared that the error is caused by an incompatibility between the "ESP32-BLE-MIDI" library and versions >=2.0.0 of its "NimBLE-Arduino" dependency.

So the solution will be to downgrade your installation of the NimBLE-Arduino library (this library is installed along with the ESP32-BLE-MIDI library) to the last compatible version: 1.4.3. I'll provide instructions you can follow to do that:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
  2. Type NimBLE-Arduino in the "Filter your search..." field.
  3. Find "NimBLE-Arduino" entry in the search results.
  4. You will see a drop-down version menu at the bottom of the entry. Select "1.4.3" from the menu.
  5. Click the "INSTALL" button at the bottom of the entry.
  6. Wait for the installation process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    ⓘ Successfully installed library ...

Now try compiling or uploading the sketch again. The compilation error should not occur this time.

Arduino IDE will periodically display a notification that offers to update the library for you:

Updates are available for some of your libraries.

If you click the "INSTALL MANUALLY" button in the notification, a list of each of the libraries that have available updates will be shown in the Arduino IDE Library Manager. It is generally a good idea to keep your libraries updated since the updates might provide important enhancements or bug fixes. So you should look through the list and update other libraries if appropriate, but you should avoid accepting the update for the NimBLE-Arduino library until such time as a new version of the ESP32-BLE-MIDI library comes out that is compatible with the latest version of NimBLE-Arduino.

Hi,
I had the same problem. Just bought an esp32 WROOM32, installed the expressif-Board drivers and the ESP32-BLE-MIDI library with the nimBLE library, all in the actual version.
But reading this thread, deleting the actual versions and installing the

0.3.1 !!! version of ESP-32-BLE-MIDI and
1.4.3 version of nimBLE

the code was translated without error. Yippies and thanks! It costs me more than 3 hours googling an trying.

1 Like