[PD] Markov chains and probability

Johnny Ferguson hyperflexed at gmail.com
Sat Nov 20 18:43:35 CET 2010


Hi,

I just read about Markov chains and how they can be applied to selecting 
pitches using probability. One thing I'm wondering is how we assure that 
our note selection matches the distribution of probability.

Let's say our current note was C4.

For the next note:

P(D4) = 0.3
P(E5) = 0.2
P(F4) = 0.5

Would we simply generate a random number R (0..1) and say:

if R < 0.3 then
   nextNote -> D4
elsif R < (0.3 + 0.2) then
   nextNote -> E5
else then
   nextNote -> F4

I only ask, because if our random number function wasn't 
well-distributed, we might actually see higher probabilities for certain 
notes than we've intended.

Simply put, what is the most effective, efficient, and accurate way to
select the next state based on a list of note-probability pairs
connected to the current state?

I'm all right with math, but probability is not one of the areas I'm
very strong in. If anyone has a simple way of explaining this, I'd
greatly appreciate it.

I can see that markov chains could be applied to far more things than
pitch (modulation, rhythm, structure, etc.), so I want to get at least a 
decent grasp on how we implement them reliably before I start going nuts 
with the idea.

-Johnny



More information about the Pd-list mailing list