I'm currently working on a MIDI project (again). But this time Iam receiving MID signals from my DAW.
For this purpose I'm using Ableton live where I draw my MIDI signal to control (perfectly in time) some lights.
Which is kinda working. BUT only, if I dont send 2 MIDI signals at the exact same time.
This would'nd be possible when a human being in sending the signal using a midi keyboard.
Bus it seems possible using any kind of MIDI program.
For investigating the issue, Ive uploaded a MIDI library example to by ESP32. There I'm using Serial2 (since Serial1 is not usable out of the box, and using Serial for debuging printout).
Code:
#include <MIDI.h>
MIDI_CREATE_INSTANCE(HardwareSerial, Serial2, MIDI);
#define LED 22
void setup()
{
Serial.begin(115200);
MIDI.begin(); // Launch MIDI, by default listening to channel 1.
}
void loop()
{
if (MIDI.read()) // Is there a MIDI message incoming ?
{
Serial.print("checkMIDI type=");Serial.print(MIDI.getType());
Serial.print(" data1=");Serial.print(MIDI.getData1());
Serial.print(" data2=");Serial.println(MIDI.getData2());
}
}
For the purpose Im sending in my DAW (4 bars at 60bpm):
(Note on at max. velocity)
* C3 and D3 On
* D3 Off
* E3 On
* E3 Off
* F3 On
* C3 and F3 Off
* - on bar of silence -
Bus it seems possible using any kind of MIDI program.
No it is not possible. MIDI is a serial protocol and you can’t send two things at the same time, there is no way to program it even if you wanted to.
So there are two possible explanations for your problem.
Ableton is not sending the messages. This seems unlikely because it is a top quality product that is very expensive. It is into its tenth iteration and if it had this problem it would have been spotted before now. Just to be sure can you post a simple Ableton setup so I can test it on my machine.
the message is being missed by your program / processor. Now I note you are not actually using an Arduino but an ESP32. This is not an Arduino but a totally different thing that has wormed its way into this forum simply because you can program it with the Arduino IDE. The big difference is that it has an operating system built into it. So maybe the operating system while looking after the WI-FI is missing some closely spaced messages.
Note you will drop MIDI messages on any real Arduino that is running an addressable LED strip of the single data wire type, ie the WS2812.
I've tried a little trick:
I've uploaded the sketch to a Arduino Nano clone I had laying around.
I had to change the code a little, so that MIDI is using the only available Serial.
And without calling Serial.begin assuming the MIDI library will do that eventually.
After upload, I hooked up a serial terminal using speed=31250.
Voila-la, I can see the Serial output (net to unreadable binary stuff).