This program generates new melodies by 'listening' to existing ones, using simple markov models. The melodies can be viewed by any program that handles MusicXML files (e.g. Finale Reader, MuseScore). It uses the music21 toolkit (http://web.mit.edu/music21).
melodyGenerator.py -- The main script.
model.py -- Contains all classes used for machine learning.
Model: Knows the probability distribution for the next note.
ModelCreator: Creates a new model from a corpus.
Predictor: Predicts the most probable next note.
Generator: Samples from the probability distribution to generate the next note.
Tester: Tests the accuracy of the model on the data set, using k-fold cross validation.
bachChorales.py -- Reads in Bach chorales from the music21 corpus.
popSongs.py -- Reads in pop melodies (data set not included).
To generate a new song: python melodyGenerator.py
For help: python melodyGenerator.py -h