GithubHelp home page GithubHelp logo

lathoub / arduino-ble-midi Goto Github PK

View Code? Open in Web Editor NEW
215.0 19.0 33.0 197 KB

MIDI over Bluetooth Low Energy (BLE-MIDI) 1.0 for Arduino

License: MIT License

C++ 95.76% C 1.10% Shell 3.14%
arduino ble midi bluetooth-low-energy arduino-midi-library transport-layer ble-midi arduino-library esp32 arduino-nano

arduino-ble-midi's People

Contributors

alf45tar avatar arik-caspi avatar aselectroworks avatar comoc avatar dacodekid avatar lathoub avatar per1234 avatar robertohe avatar wakwak-koba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-ble-midi's Issues

Crash conflict with ESP Async Webserver

I'm working on a piece of hardware/software to control a TC-Helicon VoiceLive 3 Extreme. It has become a fairly large project, and I need BLE-MIDI, and a good web server. ESP Async Webserver seems to be the popular one.

I had BLE-MIDI and a ton of other stuff working, then started adding the web server. The web server would crash the ESP32, fail to respond to a request, or stop responding after one request.

By a process of elimination, I've established that if BLE-MIDI is not started, then the web server is just fine. Can you point me to any particular place to start debugging?

I am working with PlatformIO.

BLE MIDI not sending any MIDI signal out

Hi,
This library is awesome! Before, I couldn't manage to discover the BLE device on IOS/OSX. But with your library, It work like a charm! However, When I tried to send a midi note, I didn't receive any Note on Ios/Osx. But I can read the note from Ios/Osx just fine.

I'm using this code to send a midi note
bm.sendNoteOn(60, 127, 0) ;
delay(1000);
bm.sendNoteOn(60, 127, 0) ;
delay(1000);

Is there anyway for me to send a note/ CC value?

Can't compile anymore on arduino 2.3 - conversion from 'String' to non-scalar type 'std::string'

My code used to work, but sadly, I hit the update button. :/

Now compiling my sketch with BLE-MIDI returns this:

In file included from /Users/anton/Documents/Arduino/blemidi2/blemidi2.ino:2:
/Users/anton/Documents/Arduino/libraries/Arduino-BLE-MIDI/src/hardware/BLEMIDI_ESP32.h: In member function 'virtual void bleMidi::MyCharacteristicCallbacks::onWrite(BLECharacteristic*)':
/Users/anton/Documents/Arduino/libraries/Arduino-BLE-MIDI/src/hardware/BLEMIDI_ESP32.h:116:55: error: conversion from 'String' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
  116 |         std::string rxValue = characteristic->getValue();
      |                               ~~~~~~~~~~~~~~~~~~~~~~~~^~

exit status 1

Compilation error: exit status 1

I tried the other branches of this repo too.

I'm compiling for esp32

Wrong channel number on polyphony?

Hello and thank you for your work!

When I have multiple channels playing at the same time I get into an issue:

when I send this from my computer (that comes from a monitor on the same bus as the receiver below):

1693491 14:0 Note on 0 70 80
1693491 14:0 Note on 1 63 80
1693491 14:0 Note on 2 58 80

My ESP32 BLE device gets this (direct Serial.printf() in MIDI callbacks):

ON 1, 70, 80
ON 1, 63, 80
ON 1, 58, 80

all the channel numbers are 1. Any idea what might cause this?

When I solo each channel, the number is correct.

Send/receive SysEx Messages

Thank you for this nice library, i'm using it for a while now and it works great!

The only thing i'm missing is to receive sysex message via the BLE interface. So i have seen that there are stubs to be implemented in the code for sending and receiving. Is there any chance to get this implemented? Could i help somehow?

Thanks for considering.

Hybrid client code for connections to different MIDI devices possible?

Dear @lathoub,

after I solved the basic MIDI connection problems to the Vox Adio Amp with your help my next challenge will be to build a hybrid client for my "Nux Mighty Plug" and "Vox Adio Air GT" MIDI devices. I guess that there are two possible approaches to implement this functionality:

  • determine the name of the MIDI device that the client established a connection to in the client code in order to distinguish what MIDI messages to send to the external device: SysEx-Messages for the Vox Amp or ControlChange-Messages for the Nux Mighty plug
  • try to establish a parallel BT-MIDI connection to both devices based on their MIDI-names and send the appropriate MIDI messages on the respective MIDI channel

Is there a way to figure out the MIDI-name of the connected device in the client code ... or even a way to work with two MIDI channels in parallel? I hope that I don't bother you not to much with my questions - I started with the Arduino-Platform a month ago and I'm still a novice with all that technology and Arduino-coding.

Thanks again for your help and greetings from Germany

Bernd

Active Sensing

Active sensing (or other system realtime messages) is not implemented.

Would be great to have it implemented so connected devices can show that the device is active and connected.

Compatibility with Arduino GIGA (Arduino-mbed)

BLE-MIDI does not work with the new Arduino GIGA (STM32H747XI).

The bluetooth device is visible sometimes (at least on android, not my linux desktop), but I cannot connect. I tested it with the included MidiBle example.

Trying to get bluetooth midi for Arduino Nano 33 BLE sense rev2

Hi,

I'm trying to use this lib with a Arduino Nano 33 BLE sense rev2.

I'm quite new to this. I used the include #include <hardware/BLEMIDI_nRF52.h> because that's what this board is using. I compiled ok but impossible to connect from my mac. I can't see the board as bluetooth midi.

After searching for a bit I ended up looking at the code for "hardware/BLEMIDI_nRF52.h" and see that it is written as "in development" and that all the "advertising" lines are commented out. I wonder if i should uncomment them and use the "#include <bluefruit.h>" ??

Or maybe just return the board and order a esp32 that seems way more simple to use. I chose this one because I liked the sensors and AI capabilities for future but my main usage would be midi over bluetooth.

Any help ?
Thank you !

BLE Client Problem with Adafruit TinyUSB

Hi. I want set the midi output to adafruit tinyusb host but get compile error.
the code:

#include <Arduino.h>
#include <BLEMIDI_Transport.h>
#include <Adafruit_TinyUSB.h>
#include <MIDI.h>
#include <hardware/BLEMIDI_Client_ESP32.h>

//#include <hardware/BLEMIDI_ESP32_NimBLE.h>
//#include <hardware/BLEMIDI_ESP32.h>
//#include <hardware/BLEMIDI_nRF52.h>
//#include <hardware/BLEMIDI_ArduinoBLE.h>
Adafruit_USBD_MIDI usb_midi;

BLEMIDI_CREATE_DEFAULT_INSTANCE(); //Connect to first server found
MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI);

//BLEMIDI_CREATE_INSTANCE("",MIDI)                  //Connect to the first server found
//BLEMIDI_CREATE_INSTANCE("f2:c1:d9:36:e7:6b",MIDI) //Connect to a specific BLE address server
//BLEMIDI_CREATE_INSTANCE("MyBLEserver",MIDI)       //Connect to a specific name server

#ifndef LED_BUILTIN
#define LED_BUILTIN 2 //modify for match with yout board
#endif

void ReadCB(void *parameter);       //Continuos Read function (See FreeRTOS multitasks)

unsigned long t0 = millis();
bool isConnected = false;

/**
 * -----------------------------------------------------------------------------
 * When BLE is connected, LED will turn on (indicating that connection was successful)
 * When receiving a NoteOn, LED will go out, on NoteOff, light comes back on.
 * This is an easy and conveniant way to show that the connection is alive and working.
 * -----------------------------------------------------------------------------
*/
void setup()
{
  Serial.begin(115200);
  MIDI.begin(MIDI_CHANNEL_OMNI);

  BLEMIDI.setHandleConnected([]()
                             {
                               Serial.println("---------CONNECTED---------");
                               isConnected = true;
                               digitalWrite(LED_BUILTIN, HIGH);
                             });

  BLEMIDI.setHandleDisconnected([]()
                                {
                                  Serial.println("---------NOT CONNECTED---------");
                                  isConnected = false;
                                  digitalWrite(LED_BUILTIN, LOW);
                                });

  MIDI.setHandleNoteOn([](byte channel, byte note, byte velocity)
                       {
                         Serial.print("NoteON: CH: ");
                         Serial.print(channel);
                         Serial.print(" | ");
                         Serial.print(note);
                         Serial.print(", ");
                         Serial.println(velocity);
                         digitalWrite(LED_BUILTIN, LOW);
                       });
  MIDI.setHandleNoteOff([](byte channel, byte note, byte velocity)
                        {
                        digitalWrite(LED_BUILTIN, HIGH);
                         });

  xTaskCreatePinnedToCore(ReadCB,           //See FreeRTOS for more multitask info  
                          "MIDI-READ",
                          3000,
                          NULL,
                          1,
                          NULL,
                          1); //Core0 or Core1

    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, LOW);
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void loop()
{
    //MIDI.read();  // This function is called in the other task

  if (isConnected && (millis() - t0) > 1000)
  {
    t0 = millis();

    MIDI.sendNoteOn(60, 100, 1); // note 60, velocity 100 on channel 1
    vTaskDelay(250/portTICK_PERIOD_MS);
    MIDI.sendNoteOff(60, 0, 1);
  }
}

/**
 * This function is called by xTaskCreatePinnedToCore() to perform a multitask execution.
 * In this task, read() is called every millisecond (approx.).
 * read() function performs connection, reconnection and scan-BLE functions.
 * Call read() method repeatedly to perform a successfull connection with the server 
 * in case connection is lost.
*/
void ReadCB(void *parameter)
{
//  Serial.print("READ Task is started on core: ");
//  Serial.println(xPortGetCoreID());
  for (;;)
  {
    MIDI.read(); 
    vTaskDelay(1 / portTICK_PERIOD_MS); //Feed the watchdog of FreeRTOS.
    //Serial.println(uxTaskGetStackHighWaterMark(NULL)); //Only for debug. You can see the watermark of the free resources assigned by the xTaskCreatePinnedToCore() function.
  }
  vTaskDelay(1);
}

compile error:

In file included from c:\Users\STRIX-PC\Documents\Arduino\libraries\MIDI_Library\src/MIDI.h:35,
                 from c:\Users\STRIX-PC\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\src/BLEMIDI_Transport.h:7,
                 from C:\Users\STRIX-PC\AppData\Local\Temp\.arduinoIDE-unsaved2024127-9620-yia50d.15mhn\sketch_feb27a\sketch_feb27a.ino:29:
c:\Users\STRIX-PC\Documents\Arduino\libraries\MIDI_Library\src/serialMIDI.h:101:73: error: conflicting declaration 'midi::MidiInterface<midi::SerialMIDI<Adafruit_USBD_MIDI> > MIDI'
     MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<Type>> Name((MIDI_NAMESPACE::SerialMIDI<Type>&)serial##Name);
                                                                         ^
C:\Users\STRIX-PC\AppData\Local\Temp\.arduinoIDE-unsaved2024127-9620-yia50d.15mhn\sketch_feb27a\sketch_feb27a.ino:41:1: note: in expansion of macro 'MIDI_CREATE_INSTANCE'
 MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI);
 ^~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\STRIX-PC\AppData\Local\Temp\.arduinoIDE-unsaved2024127-9620-yia50d.15mhn\sketch_feb27a\sketch_feb27a.ino:33:
c:\Users\STRIX-PC\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\src/hardware/BLEMIDI_Client_ESP32.h:636:33: note: previous declaration as 'midi::MidiInterface<bleMidi::BLEMIDI_Transport<bleMidi::BLEMIDI_Client_ESP32>, bleMidi::MySettings> MIDI'
     BLEMIDI_CREATE_INSTANCE("", MIDI)
                                 ^~~~
c:\Users\STRIX-PC\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\src/hardware/BLEMIDI_Client_ESP32.h:630:145: note: in definition of macro 'BLEMIDI_CREATE_INSTANCE'
     MIDI_NAMESPACE::MidiInterface<BLEMIDI_NAMESPACE::BLEMIDI_Transport<BLEMIDI_NAMESPACE::BLEMIDI_Client_ESP32>, BLEMIDI_NAMESPACE::MySettings> Name((BLEMIDI_NAMESPACE::BLEMIDI_Transport<BLEMIDI_NAMESPACE::BLEMIDI_Client_ESP32> &)BLE##Name);
                                                                                                                                                 ^~~~
C:\Users\STRIX-PC\AppData\Local\Temp\.arduinoIDE-unsaved2024127-9620-yia50d.15mhn\sketch_feb27a\sketch_feb27a.ino:40:1: note: in expansion of macro 'BLEMIDI_CREATE_DEFAULT_INSTANCE'
 BLEMIDI_CREATE_DEFAULT_INSTANCE(); //Connect to first server found
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

Devise not advertising

I'm trying to use this library with a Wemos D1 mini 32, but when I try with NimBle example it compiles and uploads without errors but it does not show up in my BLE scanner.
However when I try with the Basic example with "#include <hardware/BLEMIDI_ESP32.h>" it throws:

Screenshot from 2021-02-09 01-05-55

Buffer effect

I recently migrated my PedalinoMini project to the latest Arduino MIDI Library v5 using AppleMIDI, ipMIDI and BLE as transport layers.

AppleMIDI is working well as usual. ipMIDI works very well considered it is pretty new.

BLE is not working very well right now under stress situation. It works but there is a delay on receiving/sending MIDI messages.
The first messages are transmitted in real time but after some messages in a short period messages are delayed.
I am using the MIDi Wrench to sending notes swiping from one end to the other of the keyboard. Pedalino is continuing receiving notes after some seconds I finished to swipe on the keyboard. It happens only with feat/2.0.0 branch.

PedalinoMini is working at light speed with master branch of Arduino-BLE-MIDI.

Thanks
alf45tar

Is it posible connect 2 ESP32 as master/slave using BLEMIDI ?

It is possible to connect 2 ESP32 using BLEMIDI.

I've already managed to make a MIDI/BLE interface using ESP32 and connecting to an iphone. However I would like to connect ESP32 to another ESP32 to transport MIDI protocol using BLEMIDI. It is possible? Which BLEMIDI Library command is used to connect to a BLE-ID of another ESP32?

best regards

ESP32 compatibility MIDI.send

Hi,

I just tested your lib with different ESP32 and compared also performances from other BLE midi lib.
yours is actually the best, I like it ;)
but unfortunately I have a problem with Wemos D1 mini ESP32 model :
no midi sent doesn't work and I don't find yet why ?
I used MidiBle example with #include <hardware/BLEMIDI_ESP32.h>
Exactly the same code setting and test with a ESP32 Dev Kit C work perfectly.

If you have any idea why and how we have to do to resolve this problem it'll be perfect ;)

all the best, and thx for your lib :))

PlatformIO Error: #error "Unsupported board selected!" #error "Unsupported board selected!"

Build Log

> Executing task: platformio run --environment az-delivery-devkit-v4 <

Processing az-delivery-devkit-v4 (platform: espressif32; board: az-delivery-devkit-v4; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 (4.4.0) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20003.0 (2.0.3) 
 - tool-esptoolpy @ 1.30300.0 (3.3.0) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 36 compatible libraries
Scanning dependencies...
Dependency Graph
|-- BLE-MIDI @ 2.2.0
|   |-- MIDI Library @ 5.0.2
|   |-- ArduinoBLE @ 1.3.1
|   |-- ESP32 BLE Arduino @ 2.0.0
Building in release mode
Compiling .pio/build/az-delivery-devkit-v4/src/main.cpp.o
Generating partitions .pio/build/az-delivery-devkit-v4/partitions.bin
Compiling .pio/build/az-delivery-devkit-v4/lib555/MIDI Library/MIDI.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/BLEAdvertisingData.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/BLECharacteristic.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/BLEDescriptor.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/BLEDevice.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/BLEService.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/BLEStringCharacteristic.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/BLETypedCharacteristics.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/local/BLELocalAttribute.cpp.o
Archiving .pio/build/az-delivery-devkit-v4/lib555/libMIDI Library.a
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/local/BLELocalCharacteristic.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/local/BLELocalDescriptor.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/local/BLELocalDevice.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/local/BLELocalService.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/remote/BLERemoteAttribute.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/remote/BLERemoteCharacteristic.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/remote/BLERemoteDescriptor.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/remote/BLERemoteDevice.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/remote/BLERemoteService.cpp.o
Indexing .pio/build/az-delivery-devkit-v4/lib555/libMIDI Library.a
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/ATT.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/BLEUuid.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/GAP.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/GATT.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/HCI.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/HCICordioTransport.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/HCIUartTransport.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/L2CAPSignaling.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/bitDescriptions.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/btct.cpp.o
Compiling .pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/keyDistribution.cpp.o
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCIUartTransport.cpp:33:2: error: #error "Unsupported board selected!"
 #error "Unsupported board selected!"
  ^~~~~
Compiling .pio/build/az-delivery-devkit-v4/lib9a3/BLE/BLE2902.cpp.o
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCI.cpp: In member function 'virtual int HCIClass::saveNewAddress(uint8_t, uint8_t*, uint8_t*, uint8_t*)':
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCI.cpp:469:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCI.cpp: In member function 'virtual int HCIClass::leAddResolvingAddress(uint8_t, uint8_t*, uint8_t*, uint8_t*)':
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCI.cpp:496:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCI.cpp: In member function 'virtual int HCIClass::writeLK(uint8_t*, uint8_t*)':
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCI.cpp:540:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCI.cpp: In member function 'virtual int HCIClass::readStoredLKs()':
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCI.cpp:544:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCIUartTransport.cpp:99:40: error: 'SerialHCI' was not declared in this scope
 HCIUartTransportClass HCIUartTransport(SerialHCI, 912600);
                                        ^~~~~~~~~
.pio/libdeps/az-delivery-devkit-v4/ArduinoBLE/src/utility/HCIUartTransport.cpp:99:40: note: suggested alternative: 'Serial2'
 HCIUartTransportClass HCIUartTransport(SerialHCI, 912600);
                                        ^~~~~~~~~
                                        Serial2
*** [.pio/build/az-delivery-devkit-v4/liba7c/ArduinoBLE/utility/HCIUartTransport.cpp.o] Error 1
==================================================================================================== [FAILED] Took 3.77 seconds ====================================================================================================
Der Terminalprozess "platformio 'run', '--environment', 'az-delivery-devkit-v4'" wurde mit folgendem Exitcode beendet: 1.

Das Terminal wird von Aufgaben wiederverwendet, drücken Sie zum Schließen eine beliebige Taste.

platform.io file

[env:az-delivery-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
monitor_speed = 115200
lib_deps = lathoub/BLE-MIDI@^2.2

main.cpp file

#include <Arduino.h>
#include <BLEMIDI_Transport.h>
#include <hardware/BLEMIDI_ESP32.h>
BLEMIDI_CREATE_DEFAULT_INSTANCE();

void setup()
{
}

void loop()
{
}

No BLE advertisement when using example sketch

I may just be missing something obvious but when running the example sketch on the ESP32 dev board I don't see any device advertised.

I do see a device advertised when using the NIM-BLE examples so I don't think it's an issue with my board.

Any ideas?

Can't compile after update to 2.2 / Arduino BLE

Discussed in #53

Originally posted by agentff6600 March 23, 2022
Hi!

I updated to the new version today. I tried compile MidiBle.ino again onto an Arduino NANO 33 IOT (that worked before the update).

Now I get this message:

In file included from /private/var/folders/gf/tr166wdx0cbcrcgq6kl_6h7w0000gn/T/.arduinoIDE-unsaved2022223-32034-lm06d2.6h9ve/MidiBle/MidiBle.ino:6:0:
/Users/windlin/Documents/Arduino/libraries/BLE-MIDI/src/hardware/BLEMIDI_ArduinoBLE.h:5:24: error: 'SERVICE_UUID' was not declared in this scope
 BLEService midiService(SERVICE_UUID);
                        ^~~~~~~~~~~~
/Users/windlin/Documents/Arduino/libraries/BLE-MIDI/src/hardware/BLEMIDI_ArduinoBLE.h:5:24: note: suggested alternative:
In file included from /private/var/folders/gf/tr166wdx0cbcrcgq6kl_6h7w0000gn/T/.arduinoIDE-unsaved2022223-32034-lm06d2.6h9ve/MidiBle/MidiBle.ino:1:0:
/Users/windlin/Documents/Arduino/libraries/BLE-MIDI/src/BLEMIDI_Transport.h:21:26: note:   'bleMidi::SERVICE_UUID'
 static const char *const SERVICE_UUID        = "03b80e5a-ede8-4b33-a751-6ce34ec4c700";
                          ^~~~~~~~~~~~
In file included from /private/var/folders/gf/tr166wdx0cbcrcgq6kl_6h7w0000gn/T/.arduinoIDE-unsaved2022223-32034-lm06d2.6h9ve/MidiBle/MidiBle.ino:6:0:
/Users/windlin/Documents/Arduino/libraries/BLE-MIDI/src/hardware/BLEMIDI_ArduinoBLE.h:6:34: error: 'CHARACTERISTIC_UUID' was not declared in this scope
 BLEStringCharacteristic midiChar(CHARACTERISTIC_UUID,  // standard 16-bit characteristic UUID
                                  ^~~~~~~~~~~~~~~~~~~
/Users/windlin/Documents/Arduino/libraries/BLE-MIDI/src/hardware/BLEMIDI_ArduinoBLE.h:6:34: note: suggested alternative:
In file included from /private/var/folders/gf/tr166wdx0cbcrcgq6kl_6h7w0000gn/T/.arduinoIDE-unsaved2022223-32034-lm06d2.6h9ve/MidiBle/MidiBle.ino:1:0:
/Users/windlin/Documents/Arduino/libraries/BLE-MIDI/src/BLEMIDI_Transport.h:22:26: note:   'bleMidi::CHARACTERISTIC_UUID'
 static const char *const CHARACTERISTIC_UUID = "7772e5db-3868-4112-a1a9-f2669d106bf3";
                          ^~~~~~~~~~~~~~~~~~~

I am not sure what to take from this? Is it pointing at a file in var that should not be there?

Cant get it to work

Hi, I downloaded the repository and tried it as a local library in my Platformio project but couldnt get it to work. It seems that the "common/midiCommon.h" file is missing. Any ideas on how to get it to work?
Thanks in advice
Bruno

No connection from M5 Atom (ESP32-PICO-D4)

I'm trying to get the example sketches running on an M5 Atom development kit, which is based on an ESP32-PICO-D4 .

Everything builds but I'm not able to connect to the Atom from other Bluetooth devices - it doesn't show up in the list of available Bluetooth devices.

Does this library support the ESP32-PICO-D4, or am I doing something wrong? Thanks!

setHandleNoteOn called when it shouldn't

I'm using the Arduino-BLE-MIDI library in my project, latest version, it's almost identical to the MidiBle.ino example. On my computer I have a 1 bar MIDI loop going in Ableton Live. Everything works for some time, but every now and then I get two weird Note-On events.

HUB :: Note-On channel: 2 note: 61 velocity: 100
HUB :: Note-Off channel: 2 note: 61 velocity: 64
HUB :: Note-On channel: 2 note: 129 velocity: 71 <- weird
HUB :: Note-On channel: 2 note: 64 velocity: 145 <- weird
HUB :: Note-On channel: 2 note: 61 velocity: 100
HUB :: Note-Off channel: 2 note: 61 velocity: 64
HUB :: Note-On channel: 2 note: 68 velocity: 100
HUB :: Note-Off channel: 2 note: 68 velocity: 64

The notes in my clip are 61, 57, 68 and 71 and have a velocity of 100. You can see that after a note-on message a note-off if received. In my clip there is no note 129 with velocity 71, and there is no note 64 with velocity 145 (obviously).

Issue with Ableton and midi "feedback"

Hi,

First thank you for this fantastic repo. I'm doing a "4 knobs" wireless controller using encoders and led ring.

IMG_2851

The idea is to be able to control a parameter from various devices and have led feedback on each of them. The other being midi fighter twister is also based on encoders and led rings.

I came across a strange behavior, if arduino is connected to computer through BLE-midi, I have a strange behavior on ableton parameters mapped to midi CC. Not sure how to describe it, it is jerky.

Enregistrement.de.l.ecran.2024-04-14.a.13.28.17.mov

Important to note, this is independent of my code. I can upload a bare minimum code for connecting, and still have the issue. Even without :
MIDI.setHandleControlChange(OnControlChange);

For example I have the issue with this code :

#include <BLEMIDI_Transport.h>
//#include <hardware/BLEMIDI_ESP32_NimBLE.h>
//#include <hardware/BLEMIDI_ESP32.h>
//#include <hardware/BLEMIDI_nRF52.h>
#include <hardware/BLEMIDI_ArduinoBLE.h>
#include "Arduino_BMI270_BMM150.h"

BLEMIDI_CREATE_DEFAULT_INSTANCE()

unsigned long t0 = millis();
bool isConnected = false;

void setup()
{
// MIDI INIT
MIDI.begin();

pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);

BLEMIDI.setHandleConnected( {
isConnected = true;
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendControlChange(1, 1, 1);
});

BLEMIDI.setHandleDisconnected( {
isConnected = false;
digitalWrite(LED_BUILTIN, LOW);
});

}
void loop()
{
MIDI.read();
}

Maybe related to how the arduino send a "confirmation" of the received CC from ableton ?
When I look into details, ableton sends values like : 24, 25, 27, 22, 29, 32, 35 ...

But it only happens with this device and this repo. I thought it may be related to bluetooth latency, but I don't have any issue using TouchOsc on iPhone...

Any hints where to look at ?

Thank you 🙏

Trouble on macOS / Logic Pro

Hi, I created a simple Mackie HUI Recording Light for an ESP32 DevKit. While programming/debugging I used PocketMIDI and an IAC connection to monitor in/outgoing MIDI messages (I forward the MIDI data from Logic (IAC) by the Thru function to the ESP32...) . Everything is fine and works as expected in this configuration.
However if I want to directly connect in Logic to the ESP32 by BT the ESP does not react at all. What can I do?

Is it posible receive/send raw data between BLEMIDI and Serial port?

Is it possible to receive and send raw midi data from BLEMIDI to/from a serial port without having to deal with handle like setHandleNoteOn?

i just like to transfer data between blemidi and serial port without needing to know what type of midi data it is, including sysex data. It is possible?

I am using TTGO ESP32 MINI32 v1.4 LilyGO

best regards

BLE-MIDI Client: Problems when reconnecting to a MIDI server

First of all I'd like to thank so much for your brilliant library - it works (almost) flawlessly as a base for a MIDI footswitch for my guitar effect devices.
The “Nux Mighty Plug” works without any problems with your library – it uses standard MIDI-CC messages for effect switching. But a strange "phenomena" occurs with my VOX Adio amp. This amp only works with MIDI SysEx messages - and needs a delay of 400ms after the Bluetooth connection is established and before the first MIDI message could be sent, probably for internal initialization purposes. I implemented this delay in the “OnConnect”-callback routine. Everything works fine when the amp is already switched on and the ESP32 client with your library gets started. When I switch off the amp the BLE-connection gets lost and the client starts scanning for other BLE-MIDI devices. When I turn on the amp again the client reconnects, but the amp doesn't respond to MIDI messages. Everything works fine again when I reset the ESP32-client and the connection gets re-established from scratch.
I recognized that your BLE-Client code displays a "Connected to"-message in combination with the name and MAC-address of the MIDI-Server in an intitial connection scenario. In a reconnect-scenario only the "Connected to"-message appears in serial monitor. Is a re-connect scenario treated different from an initial connection in your library and is the something special to consider? I’m quite sure that the amp in general is a very sensitive MIDI server and your library is not the cause for the re- connection problems … but probably you have a hint for me to solve my problem - thanks in advance!

Password when pairing.

I couldn't find anything about requesting a password when pairing the BLE-MIDI with another device, so I guess it could be a legitimate feature request?
The reason for this is that if we don't pair a device immediately when we are on stage, and as it is not protected by a password, anyone from the audience could pair to the ESP32 running the BLE-MIDI library, and together with a midi app on his/her phone, cause a big caos on stage. I think a password is very important to prevent something like that to happen on stage. MIDI is made for musicians, and musicians perform for a lot of people..
Thanks in advance for looking into it.

Error compiling for board DOIT ESP32 DevKit V1

Hi,

I'm stuck with this error when trying the example Esp32_NoteOnOffEverySec:

Arduino: 1.8.12 (Mac OS X), Board: "DOIT ESP32 DEVKIT V1, 80MHz, 921600, None"

In file included from /Users/felixed/Documents/Arduino/libraries/Arduino-BLE-MIDI-master/src/BleMidi.h:14:0,
from /Users/felixed/Documents/Arduino/libraries/Arduino-BLE-MIDI-master/examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino:1:
/Users/felixed/Documents/Arduino/libraries/Arduino-BLE-MIDI-master/src/Ble_esp32.h:9:31: fatal error: common/midiCommon.h: No such file or directory
compilation terminated.
exit status 1
Error compiling for board DOIT ESP32 DEVKIT V1.

What can I do? I can successfully compile and run other programs on this board, so I'm assuming my toolchain works. As far I can tell common/midiCommon.h is a dependency and so far I haven't been able to find how to include it.

Thanks in advance.

BLE MIDI implementation help

I am using your awesome AppleMIDI library for my Pedalino project.
Nice to see you started a BLE MIDI library. I already implemented BLE MIDI in Pedalino, not as a library of course, but I think you can re-use a lot of source code to speed up your job.
I will be happy to move to you library when it will be released.

Cheers
alf45tar

Problem: BLEMIDI_CREATE_INSTANCE with custom names

Hello, first of all thank you for all the work you put in this project.
I have a problem with your library, specially when setting up an instance with a custom name.
the following code compiles on a ESP32 Dev Module but I'd be happy to be able to use "BLMisConnected " so the output part can decide to send BLE - MIDI or not. The problem is that I use AppleMIDI and DIN-MIDI as well, so I need to give the MIDI instances different names - DIN-MIDI is "MIDI1", AppleMIDI is "MIDI" and I'd like to call the BLE-MIDI "BLUETOOTHMIDI".
I put the compiler error as a comment next to the command I tried.

How can I sort that out?
Thanks in advance!

#include <BLEMIDI_Transport.h>

//#include <hardware/BLEMIDI_ESP32_NimBLE.h>
#include <hardware/BLEMIDI_ESP32.h>
//#include <hardware/BLEMIDI_nRF52.h>
//#include <hardware/BLEMIDI_ArduinoBLE.h>

//BLEMIDI_CREATE_DEFAULT_INSTANCE()
BLEMIDI_CREATE_INSTANCE("BLMIDIESP32", BLUETOOTHMIDI)

unsigned long t0 = millis();
bool BLMisConnected = true;  //set it to yes to see it running

// -----------------------------------------------------------------------------
// When BLE connected, LED will turn on (indication that connection was successful)
// When receiving a NoteOn, LED will go out, on NoteOff, light comes back on.
// This is an easy and conveniant way to show that the connection is alive and working. 
// -----------------------------------------------------------------------------
void setup()
{
  BLUETOOTHMIDI.begin();

  pinMode(4, OUTPUT);
  digitalWrite(4, LOW);

  // uncommented by me
  //BLEMIDI.setHandleConnected([]() {        // 'BLEMIDI' was not declared in this scope
  //BLUETOOTHMIDI.setHandleConnected([]() {  // 'class midi::MidiInterface<bleMidi::BLEMIDI_Transport<bleMidi::BLEMIDI_ESP32>, 
                                             //  bleMidi::MySettings>' has no member named 'setHandleConnected'
  //  BLMisConnected = true;
  //  digitalWrite(4, HIGH);
  // });

  // uncommented by me
  // BLEMIDI.setHandleDisconnected([]() {
  //  BLMisConnected = false;
  //  digitalWrite(4, LOW);
  // });

  BLUETOOTHMIDI.setHandleNoteOn([](byte channel, byte note, byte velocity) {
    digitalWrite(4, LOW);
  });
  BLUETOOTHMIDI.setHandleNoteOff([](byte channel, byte note, byte velocity) {
    digitalWrite(4, HIGH);
  });
}

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void loop()
{
  BLUETOOTHMIDI.read();

  if (BLMisConnected && (millis() - t0) > 1000)
  {
    t0 = millis();

    BLUETOOTHMIDI.sendNoteOn (60, 100, 1); // note 60, velocity 100 on channel 1
  }
}

ESP32 not Advertising to most of my devices

I have just setup BLEmidi on my ESP32, but only my Linux Desktop can see the ESP (Cant connect to it, it just sees it), all of my other laptops/phones cant see the ESP, I have tried installing BLEmidi from the Library Manager and tried to manually install the Autumn 21 Release but both gave me the same issue

esp32 BLE-Midi and BluetoothSerial in the same project

is it possible to use both librarys in one project?
if I use both libraries... It works for a while but after minutes it disconnects itself from the mac. and I can't reconnect without restart my esp. is there a way to solve this issue?
thanks

Would this need hairless midi?

Hi,
Just wanted to ask if this would also need hairless midi to use or will the bluetooth esp32 be detected as a native midi device?
Thanks

Not showing up in `bluetoothctl`

Has anyone tried to pair this with a machine running the bluez stack? I compiled bluez --with-midi and it is working as a MIDI-Bluetooth server already (see here).

The ESP32 running the example from this repository shows up in the Bluetooth MIDI settings in macOS (Audio MIDI Setup) and iOS (third party apps) - not in the general Bluetooth settings though.

It does not show up in the Raspberry Pi Bluetooth (bluez) settings (using bluetoothctl). Did anyone manage to make it visible there? What else could I try?

Error compiling for board DOIT ESP32 DEVKIT V1.

Hi! I have a problem... All examples not compilling

In file included from C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\examples\MidiBle\MidiBle.ino:1:0: C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\src/BLEMIDI_Transport.h: In member function 'void bleMidi::BLEMIDI_Transport<T, _Settings>::endTransmission()': C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\src/BLEMIDI_Transport.h:89:40: error: 'SystemExclusiveEnd' was not declared in this scope if (mTxBuffer[mTxIndex - 1] == SystemExclusiveEnd) ^ In file included from C:\Users\Alf\Documents\Arduino\libraries\MIDI_Library\src/MIDI.h:259:0, from C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\src/BLEMIDI_Transport.h:7, from C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\examples\MidiBle\MidiBle.ino:1: C:\Users\Alf\Documents\Arduino\libraries\MIDI_Library\src/MIDI.hpp: In instantiation of 'void midi::MidiInterface<SerialPort, _Settings>::begin(midi::Channel) [with SerialPort = bleMidi::BLEMIDI_Transport<bleMidi::BLEMIDI_ESP32>; _Settings = bleMidi::MySettings; midi::Channel = unsigned char]': C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\examples\MidiBle\MidiBle.ino:20:14: required from here C:\Users\Alf\Documents\Arduino\libraries\MIDI_Library\src/MIDI.hpp:91:5: error: no matching function for call to 'bleMidi::BLEMIDI_Transport<bleMidi::BLEMIDI_ESP32>::begin(const long int&)' mSerial.begin(Settings::BaudRate); ^ In file included from C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\examples\MidiBle\MidiBle.ino:1:0: C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\src/BLEMIDI_Transport.h:57:10: note: candidate: void bleMidi::BLEMIDI_Transport<T, _Settings>::begin() [with T = bleMidi::BLEMIDI_ESP32; _Settings = bleMidi::DefaultSettings] void begin() ^ C:\Users\Alf\Documents\Arduino\libraries\Arduino-BLE-MIDI-master\src/BLEMIDI_Transport.h:57:10: note: candidate expects 0 arguments, 1 provided Multiple libraries were found for "MIDI.h" Used: C:\Users\Alf\Documents\Arduino\libraries\MIDI_Library Not used: C:\Users\Alf\Documents\Arduino\libraries\arduino_midi_library-master exit status 1 Error compiling for board DOIT ESP32 DEVKIT V1.

BLE MIDI Client, get servers list

Hi, I have been playing with the BLE MIDI Client example on an ESP32, but can't find a way of scanning available BLE MIDI servers and connecting to one of them. Is that even possible?
Thanks.

Not showing any BLE-MIDI device with ESP32-CAM

Hi!, I have been trying to get your library to work for a couple of days without success. I have and ESP32-CAM board (ESP32-S) and I have tried your example sketch and tweak it with small variations but I haven't managed to get any device shown in the "MIDI BLE Connect" app. Am I doing something wrong? Maybe my setup is not correct?
Appreciate your help :)

Renaming it Self and loosing connection if either Serial.begin() or Serial1.begin() is used

Hi
Using this in platformio.ini (after installing Git client for Windows and restarting Windows and PlatformIO to get the Path working)
lib_deps =
https://github.com/lathoub/Arduino-BLE-MIDI/archive/refs/heads/Arduino-Nano-BLE-33.zip

Then the example "MidiBle.ino" on a Nano 33 IoT (same processor and Blox-module as Nano 33 Ble) will announce it self as BLE-MIDI, but after pairing is get the name "Arduino"
This only happens on connection to Windows on Android the name remains BLE-MIDI. I guess Android does not care to check the name.
If at any where in the example I use Serial or Serial1 then it disconnects and connects endlessly.
Just like it did until I added #include <Arduino.h> at the top of the example.
(It actually worked on an Android client without the include)

But I guess I'll give Arduino Nano ESP32 a trial. I'm trying to build a wireless MIDI connection for my Casio Privia PX-860, so I'll have to use native USB and Ble. Se til lathoub/Arduino-USBMIDI#18, maybe you can get an idea for getting the Arduino Nano ESP32 / ESP32-S3 in to the USBMIDI library.

BLE-MIDI client: Changes in NimBLE version 1.4.1

The NimBLE library changed its default response behaviour when (un-)subscribing to notifications/indications in Version 1.4.1 (h2zero/NimBLE-Arduino#470). This leads to reconnection problems with a BLE-MIDI server I use in combination with the BLE-MIDI client code. But the response behaviour can be controlled by parameters in the NimBLE library (h2zero/NimBLE-Arduino#473 (comment)).

Is it possible to introduce a user defined parameter in the BLE-MIDI client code to let the user decide whether a response should be generated on (un-)subscribing to notifications/indications or not?

Thanks in advance your support!

New Logo/Icon Proposal

Good day sir. I am a graphic designer and i am interested in designing a logo for your good project. I will be doing it as a gift for free. I just need your permission first before I begin my design. Hoping for your positive feedback. Thanks

Midi steps audible when sending a stream of CC messages for volume control

As the tittle say, when I send midi CC messages from my volume pedal via BLE it seems to introduce some steps. This does not happen if I connect the Volume pedal directly to the other device via Midi, instead of using the Midi BLE I have on breadboard.
Here is the code I am using. Do you see anything that could add delay to the midi? Or perhaps it comes from within a library?
Thanks.

#include <Arduino.h>
#include <MIDI.h>
#include <Adafruit_TinyUSB.h>
#include "BLEMIDI_Transport.h"
#include "BLEMIDI_Client_ESP32.h"

BLEMIDI_CREATE_DEFAULT_INSTANCE(); //Connect to first server found
MIDI_CREATE_INSTANCE(HardwareSerial, Serial,  MidiSerial);

// USB MIDI object
Adafruit_USBD_MIDI usb_midi;

// Create a new instance of the Arduino MIDI Library,
// and attach usb_midi as the transport.
MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MidiUsb);

byte Switch = 40;
int Led = 42; //modify for match with yout board
int MidiPwr = 41;
int timeout = 200;
bool isConnected = false;

void setup()
{
  BLEMIDI.setHandleConnected([]()
  {
    //    Serial.println("---------CONNECTED---------");
    isConnected = true;
    digitalWrite(Led, HIGH);
  });

  BLEMIDI.setHandleDisconnected([]()
  {
    //    Serial.println("---------NOT CONNECTED---------");
    isConnected = false;
    digitalWrite(Led, LOW);

  });

  pinMode(Led, OUTPUT);
  digitalWrite(Led, LOW);
pinMode(MidiPwr, OUTPUT);
  digitalWrite(MidiPwr, LOW);

   pinMode(Switch, INPUT_PULLUP);
  
  TinyUSBDevice.setManufacturerDescriptor("My_Manufacturer");
  TinyUSBDevice.setProductDescriptor("BLE_USB_Aapter");

  // Initialize MIDI, and listen to all MIDI channels
  // This will also call usb_midi's begin()
  MidiUsb.begin(MIDI_CHANNEL_OMNI);

  //  Serial.begin(115200);
  MIDI.begin(MIDI_CHANNEL_OMNI);
  MidiSerial.begin(MIDI_CHANNEL_OMNI);

  MidiSerial.turnThruOff();
  MIDI.turnThruOff();
  MidiUsb.turnThruOff();
delay(500);
  digitalWrite(MidiPwr, HIGH);
  }

  void loop()
  {
    if (MidiSerial.read()) {

      MIDI.send(MidiSerial.getType(),
                MidiSerial.getData1(),
                MidiSerial.getData2(),
                MidiSerial.getChannel());

      MidiUsb.send(MidiSerial.getType(),
                   MidiSerial.getData1(),
                   MidiSerial.getData2(),
                   MidiSerial.getChannel());
    }
    if (MIDI.read()) {


      MidiSerial.send(MIDI.getType(),
                      MIDI.getData1(),
                      MIDI.getData2(),
                      MIDI.getChannel());


      MidiUsb.send(MIDI.getType(),
                   MIDI.getData1(),
                   MIDI.getData2(),
                   MIDI.getChannel());
    }

    if (MidiUsb.read()) {
      MIDI.send(MidiUsb.getType(),
                MidiUsb.getData1(),
                MidiUsb.getData2(),
                MidiUsb.getChannel());


      MidiSerial.send(MidiUsb.getType(),
                      MidiUsb.getData1(),
                      MidiUsb.getData2(),
                      MidiUsb.getChannel());


    }
  }

Renaming it self and loosing connection if Serial1 or Serial is used.

Hi

Why did you make a new 33 branch and why didn't you update the version number after correting the namespace thing? It can be hard to find the 33 branch for a novice her on git.

Using this in platformio.ini (after installing Git client for Windows and restarting Windows and PlatformIO to get the Path working)
lib_deps =
https://github.com/lathoub/Arduino-BLE-MIDI/archive/refs/heads/Arduino-Nano-BLE-33.zip

Then the example "MidiBle.ino" on a Nano 33 IoT (same processor and Blox-module as Nano 33 Ble) will announce it self as BLE-MIDI, but after pairing is get the name "Arduino"
This only happens on connection to Windows on Android the name remains BLE-MIDI. I guess Android does not care to check the name.
If at any where in the example I use Serial or Serial1 then it disconnects and connects endlessly.
Just like it did until I added #include <Arduino.h> at the top of the example.
(It actually worked on an Android client without the include)

But I guess I'll give Arduino Nano ESP32 a trial. I'm trying to build a wireless MIDI connection for my Casio Privia PX-860, so I'll have to use native USB and Ble. Se til lathoub/Arduino-USBMIDI#18, maybe you can get an idea for getting the Arduino Nano ESP32 / ESP32-S3 in to the USBMIDI library.

Thanks for the Libraris.

Jacob

Error compiling on Nano 33 BLE

I have an error trying to compile with Nano 33 BLE. I have installed the dependencies as outlined so not sure what I'm missing here. Thanks.

In file included from /tmp/4130687144/MidiBle/MidiBle.ino:6:0:
/home/builder/Arduino/libraries/ble_midi_2_2_0/src/hardware/BLEMIDI_ArduinoBLE.h:5:24: error: 'SERVICE_UUID' was not declared in this scope
BLEService midiService(SERVICE_UUID);
^~~~~~~~~~~~
/home/builder/Arduino/libraries/ble_midi_2_2_0/src/hardware/BLEMIDI_ArduinoBLE.h:5:24: note: suggested alternative:
In file included from /tmp/4130687144/MidiBle/MidiBle.ino:1:0:
/home/builder/Arduino/libraries/ble_midi_2_2_0/src/BLEMIDI_Transport.h:21:26: note: 'bleMidi::SERVICE_UUID'
static const char *const SERVICE_UUID = "03b80e5a-ede8-4b33-a751-6ce34ec4c700";
^~~~~~~~~~~~
In file included from /tmp/4130687144/MidiBle/MidiBle.ino:6:0:
/home/builder/Arduino/libraries/ble_midi_2_2_0/src/hardware/BLEMIDI_ArduinoBLE.h:6:34: error: 'CHARACTERISTIC_UUID' was not declared in this scope
BLEStringCharacteristic midiChar(CHARACTERISTIC_UUID, // standard 16-bit characteristic UUID
^~~~~~~~~~~~~~~~~~~
/home/builder/Arduino/libraries/ble_midi_2_2_0/src/hardware/BLEMIDI_ArduinoBLE.h:6:34: note: suggested alternative:
In file included from /tmp/4130687144/MidiBle/MidiBle.ino:1:0:
/home/builder/Arduino/libraries/ble_midi_2_2_0/src/BLEMIDI_Transport.h:22:26: note: 'bleMidi::CHARACTERISTIC_UUID'
static const char *const CHARACTERISTIC_UUID = "7772e5db-3868-4112-a1a9-f2669d106bf3";

BLE MIDI Client, ESP32-S3, keeps sending serial when not connected

I am trying to make an BLE MIDI to USB Midi and Serial midi adapter. Everything works, but when it disconnects, the ESP32-S3 starts sending something on the serial pin, until it connects again.
Is this a bug? Is it possible to disable this serial in the library?
Thanks

#include <Arduino.h>
#include <MIDI.h>
#include <Adafruit_TinyUSB.h>
#include <BLEMIDI_Transport.h>
#include <hardware/BLEMIDI_Client_ESP32.h>


BLEMIDI_CREATE_DEFAULT_INSTANCE(); //Connect to first server found
MIDI_CREATE_INSTANCE(HardwareSerial, Serial,  MidiSerial);


// USB MIDI object
Adafruit_USBD_MIDI usb_midi;

// Create a new instance of the Arduino MIDI Library,
// and attach usb_midi as the transport.
MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MidiUsb);


int Led = 42; //modify for match with yout board



bool isConnected = false;

void setup()
{
 

  BLEMIDI.setHandleConnected([]()
  {
    Serial.println("---------CONNECTED---------");
    isConnected = true;
    digitalWrite(Led, HIGH);
  });

  BLEMIDI.setHandleDisconnected([]()
  {
    Serial.println("---------NOT CONNECTED---------");
    isConnected = false;
    digitalWrite(Led, LOW);
    
  });

  pinMode(Led, OUTPUT);
  digitalWrite(Led, LOW);

   TinyUSBDevice.setManufacturerDescriptor("My_Manufacturer");
  TinyUSBDevice.setProductDescriptor("BLE_USB_Aapter");

  // Initialize MIDI, and listen to all MIDI channels
  // This will also call usb_midi's begin()
  MidiUsb.begin(MIDI_CHANNEL_OMNI);


  MIDI.begin(MIDI_CHANNEL_OMNI);
  MidiSerial.begin(MIDI_CHANNEL_OMNI);

  MidiSerial.turnThruOff();
  MIDI.turnThruOff();
  MidiUsb.turnThruOff();
}

void loop()
{
  if (MidiSerial.read()) {

    MIDI.send(MidiSerial.getType(),
              MidiSerial.getData1(),
              MidiSerial.getData2(),
              MidiSerial.getChannel());

    MidiUsb.send(MidiSerial.getType(),
                 MidiSerial.getData1(),
                 MidiSerial.getData2(),
                 MidiSerial.getChannel());
  }
  if (MIDI.read()) {

   if(isConnected) {
    MidiSerial.send(MIDI.getType(),
                    MIDI.getData1(),
                    MIDI.getData2(),
                    MIDI.getChannel());
   }

    MidiUsb.send(MIDI.getType(),
                 MIDI.getData1(),
                 MIDI.getData2(),
                 MIDI.getChannel());
  }

  if (MidiUsb.read()) {
    MIDI.send(MidiUsb.getType(),
              MidiUsb.getData1(),
              MidiUsb.getData2(),
              MidiUsb.getChannel());

 if(isConnected) {
    MidiSerial.send(MidiUsb.getType(),
                    MidiUsb.getData1(),
                    MidiUsb.getData2(),
                    MidiUsb.getChannel());

  }
   }
}

Only Channel 0 messages are transmitted

I have a weird issue. Only channel 0 messages are transmitted to ESP32; and, for all those messages, the channel number received on ESP32 is 1. Other channels are completely ignored by the library.

I don't have this issue with other libraries.

decuple from midi transport?

I'd like to use this library, but I have my own midi handling code.
Is there an easy way to decouple this from Arduino-MIDI-Library ?

I'd like to get access to the bytes coming in on the characteristic, and pass them to my own midi parsing lib.

thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.