Thanks for the awesome review :D
Getting the piano keys from the MIDI file was actually not that hard, as the DRYWETMIDI library handled most of the work for me; all I did was just add some coroutines that wait until the note is played in the MIDI file and trigger the appropriate unity events. Significantly harder was the job of syncing the audio source to the MIDI, as audio runs on a separate thread and triggering all the coroutines takes a significant amount of time. D:
Originally I used WaitForSecondsRealtime (just WaitForSeconds didn't even work in the slightest), but then I noticed that a coroutine that was parsed at the beginning triggered at a different apparent time than one at the end. The final implementation involved me actually looking up the source code of WaitForSecondsRealtime (unity does that btw) to see how it was implemented. Turns out they use Time.realtimeSinceStartup which I cached before starting all the coroutines and made them WaitUntil their place in the midi file was reached, but taking into account this Time.realtimeSinceStartup. The difference between the cached and current realtime is then sent as the starting point to the audio source, which is then asked to play from there. :0 (took me ages to get right ):
Animation was done procedurally: I started by recording my digital piano with my phone, going frame by frame to see how a real key looks like when pressed and plotting that against the velocity of the key. I then used THE POWER OF MATHS to get an exponential function to determine how much time it takes until the key is depressed and used that in the PianoKeyAnimator script. I also found that the real keys will bounce back a little bit when pressed and overshoot when released and added a bit of that to the aforementioned script.
I also wanted to make it all work with custom implementations, so instead of for example hard coding the PianoKeyAnimator script to the PianoKey, I use unity events, in case someone wanted to add a custom implementation. But I was having trouble with hooking up all 88 keys, which is why I tried to make it easier with custom editor scripts (this is my first project with them :0) The video you mentioned is one I actually had not seen, but I suppose great minds must think alike :P
The assembly tip is one I wasn't aware of, but seems super useful and will definitely be using in the future. :D
The title was chosen as my goal to what this project will become - a truly interactive piano - I only had enough time to add the MIDI support in this jam (adding a sampler seems like a ton of work D:), however I very much intend to add functionality like the pressing of keys to this tool. Scenarios like your horror game is just one that I want to support, developers should be able to then decide for example whether or not they want players to be able to press the keys.
You can think of this as a demo of what is to come in that sense, Let me know if there's anything else along those lines you think could fit in here! (I've got my eyes on adding recording support as well for example) :D
Thanks again for taking the time to write about this! :D I can't wait to improve it!