I want to timestamp incoming midi data that I will read into Arduino using this midi interface and this midi library. My plan is to wait until there is data available at the serial connection, read it in and then immediately after generate a timestamp using micros(). Then I want to send the event and the timestamp over serial usb to a host. Does anything here raise a red flag with anyone? In particular, is there anything that might cause the timestamp to be inaccurate? Thanks!
A microsecond granularity is fine with me, but that's good to know about. I want to send the data over usb to a host running Matlab where I collect the midi note data, along with some other sensors that are connected to the Arduino.
As for knowing when the packet is complete, I had assumed that the midi library would handle that.
If you look at the picture in your first link, the MIDI device is connected to the serial port. You can't also use the serial port to send data to the PC.
Using that library on a Mega with multiple hardware serial ports looks possible. Using it with SoftwareSerial and any other pins looks a bit more challenging.