Something like markov-chains but w. index…

So, I’ve been having a great deal of fun with anal and prob, but… For my application I need something, which also takes an index. That is, something which is fed a series of numbers, toghether with an index (16th notes etc) and builds up probabilities tied to that index, so when queried for that index point, it puts out numbers tied to the index.

Why?

Well, markov chains are fun, but it becomes unmusical as the series quickly becomes dislodged from the rythmical patterns that were originally in the stream of numbers.

These are the chords in Django, as you can see there are reoccuring patterns split basically into four "columns", with occasional subdivisions, I want to have a first order markov chain matching, which takes the current column-number (1-4) into account, not just going from chord to chord at random.

So, upon further studies, I’ve found out I need a looping index of 16, with a 2nd order.