Click "Mary" to play Marry Had a Little Lamb. Clicking "Generate Random Mary" creates a random song using the notes of the original. Click "Play" to hear it. Clicking "Generate Markov Mary", and then "Play" will generate and play a song from a simple 1-note memory Markov model, in which we start with a note (either a random one, or the first note "e" of the song), and the second note is chosen according to the probabilities that the second follows the first in the original. Each next note is chosen according to the probabilities that the note follows the previous in the original song. Click "Generate Markov 2, then "Play", and the music generated is from a two-note-memory Markov model, in which the two previous notes are used to generate the next one.
Thanks to Cinda Heeren for this idea, and a Python implementation of the one-note model on which this is based.