max22- / ESP32-BLE-MIDI

An Arduino library to use Midi over BLE (Bluetooth Low Energy), on ESP32 boards
MIT License
228 stars 27 forks source link

Issue / Question with running messages #24

Open eugeene opened 1 year ago

eugeene commented 1 year ago

Hello and thank you for this library! I am currently working on a project where i have a code like this:

` void onNote(uint8_t channel, uint8_t note, uint8_t velocity, uint16_t timestamp) { if (channel == 9) return;

buffer[note] = velocity;

} `

It basically makes a simple map of notes played in any off the channels except drums (channel 9).

Then let's say I have a simple two track song. One track with a simple hihat running on the drum track and a second track with a simple bass.

When I solo the drums, my buffer dos not get filled, because of the condition. When my bass channel is playing solo. My buffer fills up as it supposed to. Great.

Now when BOTH of the channels play. I always get a 'bleed' from the drum channel into my buffer. The buffer note sometimes get filled by the playing hihat from the drum channel.

I am aware that there is something such as running midi messages, when the message is just 2 bytes long and so the channel stays the same. I looked into your code and presume this is handled very well in your library. I just don't know how to properly debug this. And I don't even know if this might be the issue.

Could you help in any way? Thank you.

eugeene commented 1 year ago

Maybe I found the problem. The incoming MIDI data gets often mangled into the 0 channel. For example:

Computer MIDI OUT: 13448518 132:2 Note on 0 55 80 13448518 132:2 Note on 1 60 80 13448518 132:2 Note on 2 51 80

ESP32 MIDI IN: Note on, channel 0, note 55, velocity 80 Note on, channel 0, note 60, velocity 80 Received data : 92 e1 92 33 50 Note on, channel 2, note 51, velocity 80

Any idea what might cause that?