Skip to content

Instantly share code, notes, and snippets.

@RyoKosaka
Last active September 4, 2023 15:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RyoKosaka/2a338a537d838911e23578c4595d9673 to your computer and use it in GitHub Desktop.
Save RyoKosaka/2a338a537d838911e23578c4595d9673 to your computer and use it in GitHub Desktop.
#include <BLEMIDI_Transport.h>
#include <hardware/BLEMIDI_ESP32.h>
BLEMIDI_CREATE_INSTANCE("E-Drum",MIDI);
int tempo = 280;
void setup()
{
MIDI.begin(10);
}
void loop()
{
MIDI.sendNoteOn(36, 100, 10);
MIDI.sendNoteOff(36, 0, 10);
MIDI.sendNoteOn(44, 100, 10);
MIDI.sendNoteOff(44, 0, 10);
delay(tempo);
MIDI.sendNoteOn(44, 100, 10);
MIDI.sendNoteOff(44, 0, 10);
delay(tempo);
MIDI.sendNoteOn(38, 100, 10);
MIDI.sendNoteOff(38, 0, 10);
MIDI.sendNoteOn(44, 100, 10);
MIDI.sendNoteOff(44, 0, 10);
delay(tempo);
MIDI.sendNoteOn(44, 100, 10);
MIDI.sendNoteOff(44, 0, 10);
delay(tempo);
}
@pabolojo
Copy link

Hi!, I am trying to get your example code to work but with no luck. I have loaded your code to my ESP32 and no device is shown neither in the bluetooth devices section of my phone nor in the "MIDI BLE Connect" app. Am I doing something wrong with my setup?

@RyoKosaka
Copy link
Author

I didn't have anything special set up, but I was able to connect using MIDI BLE Connect on my iphone 6. I'm using ESP32 DevKitC.
Can't you connect to it on your PC as well?

@pabolojo
Copy link

I am using an "ESP32 ESP-32 Development Board" as the vendor states, which features an ESP32-WROOM-32. I am using MIDI BLE Connect on my Android phone, don't know if that is the issue. Regarding the PC, which program (for Windows or Linux) shall I use to connect to a MIDI device?, because in the bluetooth settings section of my Ubuntu machine no device is shown.

@RyoKosaka
Copy link
Author

Hmmm. I don't know what caused it.
I tried this on android. I checked with Mobileer Inc's MIDI BLE Connect and MIDI Scope to make sure the MIDI signal was being sent.

See korg's documentation about connecting with windows.
https://cdn.korg.com/us/support/download/files/7c456d3daad3b027197b3fda1f87dce7.pdf?response-content-disposition=inline%3Bfilename%2A%3DUTF-8%27%27Bluetooth_MIDI_SettingG_E1.pdf&response-content-type=application%2Fpdf%3B

@pabolojo
Copy link

Ok, I will have a look at the windows doc, but I think my windows machine just features a 3.0 Bluetooth adapter. Maybe I am flashing the firmware with the wrong arduino settings, could you please tell me your flash settings? I have tried to connect from two Android devices, a Xiaomi Redmi and a Samsung Galaxy Tab, I don't think the issue would be caused by them, right? The BLE-MIDI device should appear in the bluetooth setting section of my devices? or just in the BLE MIDI Connect app?

@RyoKosaka
Copy link
Author

The setting of the flash is that of this image?
https://lh3.googleusercontent.com/pw/ACtC-3eIFoOfJp1N2ENPHmU_a7fsm99vbQar0FEdNo-PbfPOlpWf_8FUn7qvdbvVc5cAum-lXZm2P9z4Sdw1SC6jr1gxRf-fPi-Ikl_GeriGgHf9krjvk_KF8UZpYz0eGBFw9ZEIF-gpNm9oNVpu0Q7hbiApfQ=w1120-h890-no?authuser=0

I could only recognize the ESP32 with BLE MIDI Connect.
Maybe it's OK not to see it in Android's Bluetooth settings.

@MortenKorstgaard
Copy link

How did you setup "Logic Pro X" to read the MIDI signal from ESP32 and make the instrument play? Other than the Korg bluetooth part?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment