Automated Music Generation for Sight Reading

Melody Generator
Harmony Generator
Contact Us
Automated Music Generation for Sight Reading
Kevin McKee
Supervisor: Dr. Boaz Porat


Department of Electrical and Systems Engineering

Washington University in St. Louis

Spring 2007

We have created two computer programs that automatically generate music; the Melody Generator (click here to try it) and the Harmony Generator. The Melody Generator takes a probabilistic approach to generating a melody, while the Harmony Generator creates a harmony within the framework of musical form.
The Melody Generator is complete and is an effective means of practicing sight reading. The Harmony Generator currently creates a harmony without a melody. The Harmony Generator is still in development with the eventual goal of generating a melody to lay over the top of the harmony.

Graphical User Interface of the Melody Generator



Why automatically generate music for sight reading?


A major challenge that any beginning student faces when learning to play a musical instrument is sight reading. Whereas in some instruments each note can be played in only one way, in other instruments, most notably string instruments, each note (except for a few lowest and highest notes of the instrument’s range) can be played on several strings. For example, on the guitar, the note C4 (middle C) can be played on the 1st fret of the 2nd string, or on the 5th fret of the 3rd string, or on the 10th fret of the 4th string, and so on. Consequently, when playing a piece of music on the guitar (or any string instrument), the player must continuously make decisions as for what strings and with which left-hand fingerings to play the upcoming notes. The ability to do this at sight and without pre-reading and preparation is called sight reading.

The project described in this report focuses on sight reading for the guitar, although it can be used equally well with any instrument that uses the treble clef. On the guitar, position is defined as the fret on which the index finger rests. When playing a simple piece of music (spanning no more than two octaves), the player can usually choose a position (depending on the range of notes) and stay on the same position throughout the piece. In more advanced music, the player may have to change positions as the music flows. The choice of position is also affected by the key. For example, in the key of C, the open position as well as positions 1, 3, 5, 7, 8 and 10 are all convenient (depending on the range of the piece); however, positions 2, 4, 6, 9 and 11 are less convenient. In summary, the aspiring guitar student should eventually be able to sight read any piece of music, of any key and any range of notes.

Beginning students spend most of their time playing tonal music; that is, music in a specific diatonic key (major or minor). However, more advanced students must be able to read music that is not strictly tonal (that is, including many accidentals) or even atonal.

Another aspect of sight reading concerns the ability to read rhythm. Beginning students concentrate on regular rhythms (such as 4/4 or 3/4) and relatively long notes (such as quarter notes and half notes); more advance students need to read short notes (eighth and sixteenth). Also, advanced sight reading requires reading of irregular rhythms and syncopations.

Whereas many guitar-learning books are available, few devote sufficient attention to extensive sight reading. Even the ones that exist cannot possibly cover all positions and all keys, with varying degrees of difficulty of rhythms and atonality, while providing numerous study pieces for each choice. Motivated by this, we set out to develop software that generates melodies “on demand”, giving the user a wide range of choices, including keys, melody ranges, rhythmic irregularities, and levels of atonality. The melodies generated by the software are random; that is, they follow statistical rules rather human artistry. Consequently, they are not necessarily pleasant to the ear. Their use is, as we have said, to serve as sight-reading material, not as performance pieces.

The software described in the report was written in Java. Our reasons for choosing this particular language were its portability and the availability of rich (and free) class libraries, in particular graphic libraries. Consequently, the software will run on any computer that supports Java Runtime Environment (JRE).