I want to take a midi file as input in python or arduino and then decode it to generate keyboard press events to trigger actual keypress on a virtual keyboard like VMPK to understand/visualize how the keys are pressed.
I have built a big paino which currently reacts to button being pressed by sending keystrokes to the computer which plays music via VMPK which is a virtual keyboard. I want to be able to generate play music and simultaneously light up the corresponding keys on the keyboard so we can also see how an actual paino player has played the keys.
I currently have programmed 2 songs but it takes a while to get the timing right in code. I want to know if there is a way I can decode a Midi file and extract keystrokes and times they need to pressed and delays so I can emulate them.
I have read similar questions but they arent exactly what I am looking for.