Overtone

Nov 2016

This rhythm game was developed as my final project at BCIT. A requirement of the final project was to incorporate an innovative component into the project. The innovative component that I chose was to implement a genetic algorithm to generate music that would be used in the game. After a user defined number of iterations, the genetic algorithm would produce three sequences of notes that are the three highest rated samples in the final population. These sequences are stitched together to create a song, where the highest rated sequence becomes the chorus and the other two sequences are verses. The jMusic library was implemented as it provided helpful data structures such as notes and chords. These data structures contained values such as pitch, dynamic and rhythm values that could be altered to produce different notes. In my implementation of the genetic algorithm, several mutators were implemented including ones that mutated a note’s rhythm, pitch and dynamic value, as well as one that swapped notes within a sequence several times. Several fitness raters were also implemented such as ones that rated the number of unique pitch, rhythm and dynamic values, ones that rated how many notes are chords or rests, or ones that rated what the range of pitch, rhythm and dynamic values were. While in the end, the resulting music was not quite what I had hoped for, the genetic algorithm produced passable music, and a noticeable improvement in the music generated over time was observed.

The gameplay of Overtone is simple. Press buttons to the beat of the rhythm. Notes move from the center of the screen towards targets at the corners of the screen. Players must press the corresponding button as the note reaches the target to gain points. The closer to the target, the more points are awarded. Awarded points are also multiplied by a combo meter that accumulates as consecutive notes are successfully hit. There are three different types of notes in the game: single, double, and hold. Single notes represent one note in music and just require a button press. Double notes represent two notes in music and requires both buttons to be pressed at the same time. Finally, hold notes represent a note that is held for several beats in music. This note requires the button to be held until the other end of the note moves though the target. The game is broken into three difficulties: easy, medium and hard. As the difficulty goes down, the note movement speed decreases, and a percentage of double and hold notes get simplified into single notes. Upon completion of a song, the player is asked to rate the song. Fitness rater values are updated according to the rating provided. This in turn affects how the genetic algorithm rates sequences of notes in all later generations, as the rating values become customized to the player. One enough songs have been rated, these rater values become tailored to the player’s tastes and will make it more likely that the genetic algorithm will produce music that the player will like on subsequent generations.

Overtone can be downloaded here. Code can be viewed on GitHub.

Developed With:

  • Platform: PC
  • Library: libGDX, jMusic
  • Programming Language: Java
  • IDE: IntelliJ IDEA Community Edition