Quaver: Tile Hopper

Hypercasual and relaxing game that lets you play along to the rhythm of any song you desire.

personal

arcade

music

rhythm

Overview

In this game you control the ball to hop from one tile to another. The entire sequence follows the rhythm of the selected music. It started as an idea for a slightly engaging game for when you're idle, like in buses or transit.

Available on playstore
Quaver-Banner

My Role

I was the Solo developer behind the game, responsible for creating every detail in the game from the Art to the Code, and UI.

Challenges

making a rhythm game can be challenging, especially when you want the player to be able to import their own music. That said, the biggest challenge I faced was on beat extraction.

• Beat Extraction

Beat extraction is the whole process of analysing the music or audio source to determine where the beats lie (usually measured in time from the start). You can think of the beats of a song as that part you nod your head to while listening. My initial beat extraction process involved setting a secondary audio source to play audio at a few seconds offset, before the main audio source. The time offset was a function of the tile speed and travel distance, and the secondary audio source was silenced with audio mixers, so that we only hear the main audio source. By using Unity's (which applies a Fast Fourier Transform) on the secondary audiosource, we get the frequency spectrum data, split into bands. Finally, by observing the lower bands, for instances where the value is above a set threshold, a tile is spawned.
Initial Beat Extraction And Game Setup
The problem with this setup is that the detection is far from accurate. It could be better if one could run multiple processing loops on the audio to pick out the best filter thresholds and to apply other processing operations, however the GetSpectrumData method only works for playing audio sources, and Unity doesn't allow you get the frequency spectrum data for the entire audio clip. To solve this, I brushed up my knowledge on Fourier transforms, and learnt the Discrete and Fast Fourier Transform (FFT). With this knowledge, I was able to write a class to get the frequency spectrum data for an entire audio clip
Converting Audio Signal To Frequency Spectrum Data
Another problem in beat finding is that; often times, the beats found may not be evenly distributed throughout the audio track, thereby creating empty spaces, or moments of no action. After much theoretical analysis, I suspected that passing the frequency spectrum data through another Fourier transform would indicate the frequency of the rise and drop of values in their respective frequency bands, in other words, the prevalent BPM (Beats Per Minute) of that frequency band. This would be useful because I can utilise the bpm to fill any blank spaces left after beat finding. I was able to confirm that my suspicion was correct after further testing, however due to reaching my time budget for the project, I resorted to using only the BPM value to determine when tiles are spawned in the game. A blog post on this topic going into more details would be in the works, but please feel free to contact me if you feel I could be of help.
Uneven vs Even Distribution Of Beats

• Importing Music

Another notable challenge I experienced here was in getting access for the user to import music. Before Android 11, games made with unity could easily access all the files on the android device through the File API, however from android 11, Google began to enforce scoped storage, limiting app access to external storage. This means I couldn't just search the device's directory for audio files as I used to with the File API. Android however, still allowed developers to access media files, or other common files via APIs like Mediastore. Unfortunately, those APIs were not readily available on Unity's c#. In summary, to solve the challenge of importing music, I ended up writing an android plugin that implements the Intent API.