- keep a threshold volume level, with a beat occurring whenever the volume exceeds the threshold
- set the new threshold to be the last beat; this prevents a cluster of beats detected
- let the threshold level decay over time
- keep track of the time when the last beat was detected to ensure false positives are reduced
I made the gameplay a little more challenging by giving the player obstacles to avoid: columns of "fire" that represent the frequencies of the song. Here's what gameplay looks like now:
Your score is constantly increasing, but when you touch the red/yellow portions of the screen your score decreases. I wanted this game to be a more casual experience focused on the music, so falling off the platforms only results in the player losing half of their points; in a sense you can't really "lose" the game. The beat detection algorithm seems to work best when there is a strong underlying pulse to the song; songs with too much "noise" across the frequency spectrum cause the beat detection algorithm some trouble.
The game can be played here, and you can even play with songs you have locally! The preloaded song takes a little while to get loaded, but local files should be up and running relatively quickly. The preloaded song "Point of Departure," is done by the awesome VeraIcon. People who were in Computational Graphics this past fall may recognize a portion of the song from the procedural cities midterm :)
I think my jam is more or less complete; I may tinker with the beat detection algorithm to see if I can get it to be more precise or try implementing tempo detection (shown here) if I have more time. I worked approximately 10 hours during this jam, with most of it spent reading up on and experimenting with beat detection.
I'd love to get some feedback on the game, as I feel the gameplay can be polished up much more (plus I'm sure there are some bugs). Thanks, and good luck to everyone who's still working!