I made this little Markov chain MIDI file generator using Clojure a couple years ago. It's pretty rudimentary, but it was a fun little project to work on: ... more
bogdan: Nice. I'm often intrigued by the thought of programmatically-generated audio but never actually do it. Do you have any samples online of what this sounds like?
dylan: I posted a small piece generated from Bach's Goldberg variations to my SoundCloud account a while back but have since removed it to make way for other tracks (I'm too cheap to buy a paid account, ha). Since it's on Github you're of course free to clone it and run some MIDI files through it, though if you do end up using it I apologize in advance for the horrendous GUI.In general, I found that a 2nd-order Markov Chain performs reasonably well when the input has a well-defined melodic and harmonic structure and a sufficiently large corpus of musical data to draw upon. For music that is more improvisational in nature (e.g. Liszt fantasies), the results are not all that useful, but still occasionally interesting. Using a third or fourth order Markov Chain might yield better results since the current state transition (pitch) now depends on the previous three or four states.The other thing I couldn't really get "right" was altering the rhythmic component. I think that was probably a combination of poorly implemented MIDI note on/off event timing but it could also be that Markov processes aren't well suited for the particular corpus of data I was working with.