DebuSequencer

A play on the composer Debussy and Sequencer, this project was written by myself and two friends when learning about machine learning generation. The three of us have a love of music, and wanted to try creating our own music generator written in Python (lovingly calling ourselves Wu-tang GAN - maybe a bit nerdy).

The goal: create music that will stylistically mimic the source.

 

How we built it:

Using libraries such as Keras, music21, Numpy, and Flask, we built upon a recurrent neural network with a long short-term memory in order to recognize and retain patterns in music.

The training dataset was midi files. The reason we chose midis is because they contain the following data that is easier for a model to read through: key signature, tempo, note duration, note velocity, pitch, and octave. We scoured many midi files using MuseScore under a select number of artists in order to build a dataset that would allow the model to use these factors to build similar-sounding music.

Example of how we extracted elements of the midi files to build our dataset:

def __extract_rest(element):
    return '&&', '0', element.duration.quarterLength#__extract_quarter_length(element.duration.quarterLength)

def __extract_note(element):
    return (str(element.pitch.name) +
            str(element.pitch.octave),
            element.volume.velocity,
            element.duration.quarterLength)#__extract_quarter_length(element.quarterLength))

def __extract_chord(element):
    current_chord = []
    for i in range(len(element.pitches)):
        current_chord.append(str(element.pitches[i].name) + str(element.pitches[i].octave))
    current_chord = [tuple(current_chord)]
    current_chord.append(element.volume.velocity),
    current_chord.append(element.duration.quarterLength)#__extract_quarter_length(element.duration.quarterLength))
    return current_chord

Overall

This was a super fun project for us since it allowed us to use our love and interest in music and music creation, alongside learning new tools in machine learning and model generation.

To view the full project, go to the GitHub link here