How Would I go About Making a Rhythm Game?

Hello!

I want to start making a rhythm game where a song plays, and you have to press random buttons to the beat of the song. I want to be able to detect significant beats in the music and then instantiate an indicator for which button to press.

I feel like this could be simple to do (but I could be wrong since I have absolutely NO experience working with music in Unity).

Is there a method I could call before the game starts to find these beats in the music clip?

If the notes are random, you can just take the BPM of the song and spawn based on that. That could be once every 4 beats, every 2 beats, every beat, every half beat, etc.

For automatically increasing intensity you could look into reading the audio (not sure how exactly).
Maybe the average sound level of that section of the clip to see when more music is played? Or when the average frequencies change much, indicating a change of music?

How would you get the bpm for a song with code? Is there a method?

There were several libraries for music analysis, I think a lot of them for C++. Have you actually tried search engine?

The thing is, very often those games feature hand-crafted tracks. Meaning somebody placed every note, manually, using existing track as a reference. Beat Saber works this way. Same deal with Guitar Hero.

If you wanted to guess the bpm of a wave file without any prior knowledge, you could

  • read the uncompressed samples
  • perform a fourier analysis to break it down into frequencies
  • inspect the lower frequencies and ignore the higher frequencies
  • look for peaks in the lower frequency energy
  • find the median gap in time between peaks (not mean gap, median gap)
  • assume that the median gap is the beat, and inversely the beats per minute
  • hope that the song doesn’t change signature in the middle

I second Koreographer, used it back in 2016 and it was great then, its come leaps and bounds since then

If you want to make a good rhythm game, you most likely need to create track-specific gameplay markup, and custom tools for editing it. It’s not just about detecting a beat, you need the gameplay to match the intensity of the music and maybe the rising and falling pitch of melodies.

(Although these days, maybe there’s the potential for an AI-based solution to generating it procedurally for arbitrary music tracks… I wonder if there’s enough existing Guitar Hero/Rock Band data to train an AI to generate markup for arbitrary tracks? Purely in theory of course, wouldn’t want to get into the potential copyright issues there…)

1 Like

Did you mean AI generated songs? if yes, indeed there exists and i even used it. The one that i prefer is Suno (app.suno.ai), but you could choose your preference, such as AIVA, mubert, riffusion, or any other.

About placing the notes yourself in a rhythm game, it can significantly increase the quality of the level and the sync, altough would be easy to hear the song till get sick. Try to make asystem that makes you able to create the notes of the level hearing song once or twice.

Normally, is possible to get song info where you found it, such as the mood, or even the BPM, but some sound engine would help