Chords
We used a datasets of chord progressions in various styles such as house, hip-hop, pop, lo-fi, etc., as a foundation for our composition. Our approach was to transpose all chord progressions to one key, and then randomly sample a chord progression every 4 bars. In particular, we used the Splice Chord Progression MIDI Dataset and the BasicWavez 50 Famous EDM Chord Progression MIDI Dataset. Combined, this gives us 100 chord progressions for use.
After importing the datasets, we transposed everything to C major / A minor. This allowed us to make sure our composition stayed in the same key when combining chord progressions, allowing it to sound like one song. After this step, we noted that while most chords were in the key of C, there were some strange chords remaining in the jazz chord progressions. They sounded cool though, so we kept them.
We next cleaned the chords to be in 4/4 time and extracted only the first four measures of each progression. The rationale here was that chord progressions in popular music repeat in periods of four, so this is sufficient to capture the entire progression. Forcing all chord progressions to only span 4 measures allowed us to build a composition in which we could change the chords every 4 measures.
Finally, we randomly sampled a chord progression from our datasets every 4 measures and added that to our composition. Surprisingly, this sounded fairly fluid, presumably because all progressions were transposed to C to begin with. Along with the drums, the system sounded pretty decent already.
Chord Similarity
For the loop selection, explained in further detail in the next section, we had a data structure that mapped chords to loops. However, each chord didn't always have a perfect match, so we determined a chord similarity algorithm to find the next closest match. We decided on pitch similarity, where we took the set of all the notes in each chord, and determined the proportion of matching notes to non-matching notes. We then took the chord with the highest proportion.
Below is a demo of our chord generator. The demo generates a 4-measure chord progression, and you can vary the random seed to see different progressions.