FortySevenEffects / arduino_midi_library

MIDI for Arduino
MIT License
1.56k stars 253 forks source link

MIDI Messages One Message Behind #163

Closed acumartini closed 2 years ago

acumartini commented 3 years ago

Hey all. Not sure this is an issue with your library but want to confirm. I am running the Adafruit TinyUSB MIDI lib, which uses your lib under the hood and my messages appear to be one step behind.

For example the first message the system sees is a NOTE_ON message, but only after I release the note. So hitting three consecutive keys on a virtual midi keyboard shows up like this in the NoteOn and NoteOff handlers:

15:56:27.083 -> Note on: channel = 1, pitch = 60, velocity - 100 15:56:30.077 -> Note off: channel = 1, pitch = 60, velocity - 0 15:56:30.511 -> Note on: channel = 1, pitch = 62, velocity - 100 15:56:31.779 -> Note off: channel = 1, pitch = 62, velocity - 0 15:56:32.143 -> Note on: channel = 1, pitch = 65, velocity - 100

As you can see I released the last note and the last message is a NOTE_ON type. Any ideas or pointers? Should I be bugging the maintainers of the Adafruit lib?

Note: I am on OSX using CoreMIDI to connect to the board via USB. Thanks!

franky47 commented 3 years ago

No idea what could happen here.. Did you have any luck with the Adafruit maintainers ?

Tpigman commented 3 years ago

Any luck figuring this out?

touchgadget commented 2 years ago

I ran into the problem using a Pi Pico board.

https://github.com/adafruit/Adafruit_TinyUSB_Arduino/issues/64 indicates the problem has been fixed.

https://github.com/earlephilhower/arduino-pico/issues/352 indicates if using the Earle Philhower RP2040 board package, it includes an out of date Adafruit_TinyUSB library. The solution is to install the latest version of the Adafruit_TinyUSB library using the library manager. The IDE will use the newer version.

franky47 commented 2 years ago

Thanks for the report @touchgadget, much appreciated.

Closing this for now, @acumartini feel free to reopen if the suggested fix does not help.