Markov Chain Based Realtime Composition
The goal of this composition project was to be able to take in a series of midi notes as input, section them into measures, harmonize them with chords, create a B sections, and compose a whole song in ABA’ form.
Using the musx package, the music notes are symbolized through MIDI notes with a pitch and duration. The program takes these durations and splits the entire melody into measures (tuples) up based on an input of tempo and time signature. Taking each tuple and analyzing the notes within it, we can harmonize the notes based on an input key signature. Each measure is assigned a chord based on a penalty score: how far away it is away from a note within the chord and how much time it takes within the measure itself. Then it has a possible modal shift a third or fifth away. The chords are finally put through inversions to voice lead chords.
The B section takes the original melody and put it through a markov analysis with a depth based on a user input of similarity. A new melody is created with this markov chain, and it is harmonized with the steps above.
Using the composer within the musx package, we are able to create a MIDIFile that can be read. For this project, I created a pipeline to my Ableton Live 11 session and played the chords, melody, and countermelody using Vital.
Throughout this project, there is a goal for computer music to sound “good”, where the chords fit and the melody makes sense. While working on this, I found that one could look at it in two different aspects, one where computer music is a genre in itself, and one where computer music is only mimicking other genres. I believe that computer-composed music has its own aesthetic ideals and can be viewed as a area of music itself.