InvisibleWrench / FlutterMidiCommand

A Flutter plugin to send and receive MIDI
BSD 3-Clause "New" or "Revised" License
95 stars 50 forks source link

Inconsistent sysex messages received on Android #85

Closed intonarumori closed 2 weeks ago

intonarumori commented 1 year ago

I'm developing an app that receives 123 bytes in a single syses message.

I've tested my app with the following devices:

Everything works as expected, except on the Nothing Phone (1). Instead of the 123 bytes, I sometimes receive only 75.

I've opened the generated Android project and started poking around to see if it's an issue with FlutterMidiCommand or the data is already shorter when coming from MidiReceiver and it looks like it's already corrupted before hitting the plugin.

I've exhausted my ideas on what else to try to make it work and I'm also a bit worried that there might be other Android devices that will have the same issue. Do you have any tips on what else could I try?

Many thanks.

mortenboye commented 1 year ago

Hi, for testing you could try the https://github.com/InvisibleWrench/FlutterMidiCommand/tree/selfcontained-ble-midi branch. In that branch BLE is not handled by media.midi, but by the BLESSED library and MIDI parsing is handled directly by the FMC plugin. By using BLESSED, better robustness might be achieved on the BLE part, which might help in you situtation.

intonarumori commented 1 year ago

I'm a bit confused, I'm not using BLE, but direct USB connection. Do you think the above tip is relevant to that?

mortenboye commented 1 year ago

Ah sorry, I did not realize that. Please disregard my previous comment.

Not sure what the underlying issue is.

intonarumori commented 1 year ago

Thanks for the reply.

FYI, I did more testing with the hardware:

Not sure if there might be a regression in the MIDI handling of Android, the only thing I noticed is that only part of the SysEx message is dropped that contains only 0s, but that might or might not be related. Maybe I get new ideas with fresh eyes.

Thanks for the reply once again, I'll keep you updated if I find out more.

intonarumori commented 2 weeks ago

Closing this issue for now, as I'm not experiencing this any more. If it pops up again, I will open a new discussion