- Home /
Problem is not reproducible or outdated
Making a piano sin
hey guys i just started to build a piano sim and i have the keyboard layout ready and i want to know how can i do those thing:
the music plays along and shows which keys to press
the music will continue only if i pressed the right key(else it will play some error).
what is the idea behind those thing
thanks.
1) If you're going to have normal WAVs or $$anonymous$$P3s as the music, it is pretty much impossible to programmatically calculate which key to press and when, so the solution would be to manually make the list of notes and add data about when to press each note. Believe or not, that's how the game Rock Band was made; each song and note is manually placed.
When the song is playing, you'd read this data and measure how long the song has played and based on that highlight the keys that need to be pressed when your data says so.
2) As explained in #1, stop the music if the key wasn't pressed in time according to the data.
I'm sorry but your questions are terribly open and non-specific. Giving a code example of either of those things would require hundreds of rows of code and basically coding the game for you. I don't think anyone will be willing or able to help you accurately before you manage to narrow down your questions to isolated technical problems :)