Missing Midi Events 2 Notes at the same time - possible?

Dear MIDI experts,

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 -

This MIDI signal is producing on serial monitor:

checkMIDI type=144 data1=60 data2=127
checkMIDI type=128 data1=62 data2=64
checkMIDI type=144 data1=64 data2=127
checkMIDI type=128 data1=64 data2=64
checkMIDI type=144 data1=65 data2=127
checkMIDI type=128 data1=60 data2=64

This repeats.

As you see, there is NO NoteOn (144) for note 62 (D3) only a NoteOff (128)
Also there is no NoteOff for note 65.

I've already tried to replace using the MIDI library, by doing plain Serial handling at speed 31250.
With exactly the same results.

Any ideas?

I'm working on this project for 2 weeks now, putting it to a real test today. Then discovering THIS. :frowning:

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.

  1. 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.

  2. 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.

Hi

1st, thanks for your explanations.

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).

Here's the output:

checkMIDI type=144 data1=60 data2=127
�>@checkMIDI type=128 data1=62 data2=64
�@␡checkMIDI type=144 data1=64 data2=127
�@@checkMIDI type=128 data1=64 data2=64
�A␡checkMIDI type=144 data1=65 data2=127
�<@checkMIDI type=128 data1=60 data2=64
�<␡checkMIDI type=144 data1=60 data2=127
�>@checkMIDI type=128 data1=62 data2=64
�@␡checkMIDI type=144 data1=64 data2=127
�@@checkMIDI type=128 data1=64 data2=64
�A␡checkMIDI type=144 data1=65 data2=127
�<@checkMIDI type=128 data1=60 data2=64

And again, I cannot see the NoteOn for note 62.

So.. whats next..? Give up? Live with the fact, that I have to make sure no notes are triggered at the same time?

thanks
Robert

Ok. Another try:

I replaced the MIDI library with simple Serial readings.
Here's the code:

void setup()
{
  Serial.begin(31250);

}

void loop()
{
    if(Serial.available()>2)
    {
      byte commandByte = Serial.read();//read first byte
      byte noteByte = Serial.read();//read next byte
      byte velocityByte = Serial.read();//read final byte
      Serial.print("ReceivedMidi: cmd=");
      Serial.print(commandByte);
      Serial.print(" note=");
      Serial.print(noteByte);
      Serial.print(" vel=");
      Serial.println(velocityByte);     
    }
}

But still the same result:

ReceivedMidi: cmd=144 note=60 vel=127
ReceivedMidi: cmd=128 note=62 vel=64
ReceivedMidi: cmd=144 note=64 vel=127
ReceivedMidi: cmd=128 note=64 vel=64
ReceivedMidi: cmd=144 note=65 vel=127
ReceivedMidi: cmd=128 note=60 vel=64
ReceivedMidi: cmd=144 note=60 vel=127
ReceivedMidi: cmd=128 note=62 vel=64
ReceivedMidi: cmd=144 note=64 vel=127
ReceivedMidi: cmd=128 note=60 vel=64

btw. I've also checked with a MIDI monitor app, that there is a NoteOn for D3. Yes there is.

How did you route the MIDI from Ableton to the Arduino? Might be a faulty or poorly designed USB-MIDI converter.

Pieter

OK.. Hold on... what if it is the cheap Midi2USB connector I'm using???

YES!

I also have a guitar multi effect in the case which has USB and MIDI in... after hooking that one up!
It works! Damn cheap ***** cables!

I Have a complete cycle:

ReceivedMidi: cmd=144 note=60 vel=127
ReceivedMidi: cmd=144 note=62 vel=127
ReceivedMidi: cmd=128 note=62 vel=64
ReceivedMidi: cmd=144 note=64 vel=127
ReceivedMidi: cmd=128 note=64 vel=64
ReceivedMidi: cmd=144 note=65 vel=127
ReceivedMidi: cmd=128 note=60 vel=64
ReceivedMidi: cmd=128 note=65 vel=64

@PieterP, you got it right!
Ok, never mind. And Thank you!