Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
A jam submission

Interactive PianoView project page

Add an interactive piano to your next unity project!
Submitted by TheTrueDuck — 6 minutes, 6 seconds before the deadline
Add to collection

Play tool

Interactive Piano's itch.io page

Results

CriteriaRankScore*Raw Score
How much I could potentially use it in the future#143.5003.500
How original or innovative it is#143.8333.833
Overall#173.6673.667
How nice it is to use#303.6673.667

Ranked from 6 ratings. Score is adjusted from raw score by the median number of ratings per game in the jam.

Leave a comment

Log in with itch.io to leave a comment.

Comments

Submitted

I love that the keys actually move differently for every song. I don't know what wizardry you actually used but converting a MIDI file to the actual piano keys being pressed is incredible.

This can be used so for many situation, for example even for a horror game this could be cool where a creepy songs starts playing and the piano keys actually move by themselves.

Overall really cool and creative idea for a tool and amazingly well done.

____________________________________________________________________________________

The project intrigued me so much I even had to have a look at the source code. I did see that you used DRYWETMIDI to handle midi files. I can also see that you watched the Pause in Unity WITHOUT Timescale video for your Pausing ;P and I appreciate how much your worked with Custom Editors to simplify your workflow (recently got into that as well).

Overall really cool project I do hope it wasn't to tedious tough to enter the animation state for all the keys tough XD.

Btw. I would recommend putting your files into a separate assembly so it doesn't bog down compile speed when a user that uses the package makes changes to their code.

____________________________________________________________________________________

PS. the title might be a bit confusing tough I'd rather choose something like "MIDI piano animator" or something in that direction, because currently the title makes you think that you can press the keys yourself even tough what you currently have is, in my opinion, much cooler.

Developer(+1)

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!

Submitted

This piano can decorate any game... but where is the interactivity? I wanted to press the keys.

Developer(+1)

Yeah, this was actually the original intent, but quickly got too much out of scope once I realized all the stuff that had to be added D: 

I am still planning to update it and this will definitely be in that new version :) I will say though, that the current version can certainly still be used for cutscenes or credits, where I think it works quite well :D