-
Read a MIDI file and convert that to an internal representation.
-
Model as a Markov process: Populate matrix of transition probabilities.
-
Use the learned model to generate a music sequence based on some initial state.
-
Prune the MIDI file to contain a single channel with no polyphony. Use various commands (as seen in Akarsh's scratch file) to identify various aspects of the MIDI file. Set these parameters in all the python scripts.
-
Run midi-to-unigrams.py to generate a list of unigrams from the MIDI file. This program dumps to stdout, so you might want to redirect the output into a file. The input MIDI file is set in the python script.
-
Run unigrams-to-ngrams.py to generate a list of n-grams from the MIDI file. The input file is specified in the python script. The program dumps to stdout, so you might want to redirect the output into a file. The 'n' of n-grams is specified inside the file. Last few notes may be clipped, especially for large 'n'.
-
Run the appropriate scripts to generate the Markov model (TODO: Fill in details).
-
Run the appropriate scripts to generate random realizations of the Markov model (TODO: Fill in the details).
-
Convert the n-grams from the Markov model back into unigrams using ngrams-to-unigrams.py. This script takes the input file on the command line (as the first argument), and outputs to stdout.
-
Resynthesize a MIDI file from the unigrams. The script takes both the input file (first argument) containing unigrams and the output MIDI file (second argument) as command-line arguments. Tempo, instrument, transpose and other settings are specified in the python script.
For a simple introduction to the concept of Markov chains, check http://austingwalters.com/introduction-to-markov-processes/