[PD] Markov chains and probability

Frank fbar at footils.org
Sat Nov 20 21:25:24 CET 2010


Hi Johnny
I think you got it all right. A useful abstraction for Markov chains  
is the list-wrandom object in the list-abs collection. Also see the  
c_markov and c_markovanal objects in the rj-library. They provide both  
analysis and generation of markov processes.
Ciao
Frank

On 20.11.2010, at 19:43, Johnny Ferguson <hyperflexed at gmail.com> wrote:

> 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
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list



More information about the Pd-list mailing list