Based on the midi generator https://forum.pdpatchrepo.info/topic/10791/markovgenerator-a-music-generator-based-on-markov-chains-with-variable-length that i made with @ingox some time ago I made a Lua markov chain generator that generates endless markov chains from midi files.
The patch needs the Ofelia, Cyclone and Zexy libraries.
I have one question: Is there a way to keep the "original" sounds from the midi file? Perhaps if i store the midi control data together with the other values (pitch, velocity, program change, midi channel)? Somehow the midi program change values do not have the "right" sound information. If I play midi files with the [seq] object it sounds like it should. So for now i choose the sound manually but it would be nice if it sounds like it is meant to.
LuaMidiMarkov.pd
A silly example: