On Markov Chain Music

Ever wonder what music produced by a Markov chain might sound like?  Yeah, me too! ...and... wonder no more!  So I went to where the piano is and grabbed the more regular, simple score I could find.  As it turns out it was Mozart's Twinkle Twinkle variations (Zwolf Variationen uber "Ah, vous dirai-je, Maman" KV 265).  Because it is written in C major and the notes are mostly regularly spaced this was great!  I used the first variation (more notes) to produce a transition probability matrix.  Perhaps an important thing to note (pun intended) is that the range is from B to E (about an octave and a half).  The little song produced is about 30 measures and has no real tune to it, although in some parts it does resemble the original melody.  Also, I added three non-random notes at the end to make it end gracefully.


Of course, arranging it a bit it can sound marginally better;  here's how I've done it, adding accompaniment and instruments, using Garageband's licks and prefabricated transitions (to save time).  Enjoy!


(I hope Mozart is not writhing in his grave!)

  1. May 4th, 2010 at 12:20 | #1

    Nah, he's gyring in the wabe!

  2. April 17th, 2013 at 11:22 | #2

    I'm experimenting with some generative music and needed a simple example of how you could construct a musical markov chain that actually sounded pleasant.

    I had no idea you could just pick a song and generate the model yourself. It makes sense.

    Thanks for posting this.

  1. No trackbacks yet.