Science Models
Science Fair Projects

Published on Sep 19, 2023


The objective:

The purpose of this research project was to develop a computer program that randomly generated musical melodies in a given key signature, and then to revise this program in a way that it would emulate the human creative process of music composition in its generation of musical melodies.


Two versions of the program were written, with the first version being a simple randomized melody generator, and the second version containing several algorithms I developed in order to mimic the human creative process of music composition.

In version 1.0 of the Melody Generator, a "while" loop was set up to generate random fitting rhythm values in one function that would be transfered over to another function.

This function would then match randomized note values within the given key to the rhythm values and output the results. In version 2.0 of the Melody Generator, four algorithms were developed to add musical coherency to the melodies produced:

The Downbeat Algorithm, Tonic Algorithm, Leading Tone Algorithm, and Rhythm Repetition Algorithm. The resulting melodies of both versions were then tested and rated in a blind test on a 1-10 scale of coherency ten times for each given key.


The melodies generated by version 2.0 were on average rated 27% higher than those generated by version 1.0. The mean coherency rating produced from version 1.0's melodies was a 3.4 out of 10, while the mean coherency rating produced from version 2.0's melodies was a 6.1 out of 10. Melodies produced by version 2.0 were far more coherent, logical, and musically pleasing than those produced by version 1.0.


The data supported my hypothesis that, through the implementation of several AI algorithms that emulate the human musical composition process, the second, revised version of the music-generating-program would generate more coherent and pleasing melodies than those produced by the first version.

Melodies produced by Version 2.0 of the program were rated an average 27% higher than melodies produced by Version 1.0, and, overall, sounded far more coherent, legible, and musically pleasing than the melodies produced by Version 1.0.

It can be assumed that the development and implementation of the Tonic Algorithm, Downbeat Algorithm, Leading Tone Algorithm, and Rhythm Repetition Algorithm directly increased the ratings of Version 2.0 melodies.

This computer project centered around the development of a computer program that composes musical melodies in a way that emulates the human creative process of music composition.

Science Fair Project done By Nadav Hollander