### Weighted choices in random melody

Hi all,

I’m wanting to generate a random melodic line, that clusters around specific degrees of the scale.

Each bang that the system receives creates a number between 0 & 11, but with the choice weighted towards 0, 2, 5, 7 for example. (transposition, forcing to a scale, and rhythm are handled seperately).

So – a continuous stream of single numbers, between 0 & 11, with variable amounts of weighting towards specific numbers.

(I have both Litter Pro & RTC-lib, but I can’t figure out how to use them for this – if indeed this is what I should do!)

I don’t have the math experience to make sense of this, so I’d be gratefu lfor any help offered!

Thanks

David

I think you might find this article helpful.

http://algocomp.blogspot.com/2008/10/probability-distribution.html

Litter or RTC is probably best, but there’s always this kinda simple thingamaging with itable:

**all**of the following text. Then, in Max, select

*New From Clipboard*.

----------begin_max5_patcher---------- 565.3ocsUssiaBCD8YxWwH+zVI1U.IjjV09P+NpVsx.SBtBrQ3gFnq1+85KP tTwtcaSpTjG4iGaOmyAO44EArLUOpYvmfuAAAOuHHvAYABFmGvp484UbsKMV tptFkDKzuFg8jC+yREIxQfJ4DHjlnPCBhmUggPTHjDBog.WV.a.dKBsbgFK. RYxDgccUUv.7CdUGBpcPbjYKZEbnDkvfpCx3x8tLmNRAAJY0.n5nlNRaWSif rqNCa0SUWkPh4pNoqDSGAM4HjUH43S7H3NkjzhehNrjGhNkq4BlRdBsgS4kB 49mZwbxKdqiL6Ah2l3BqWaCaReHBdbbOhBmLox998orytTIu1coru1J3UL6B urXgcH7ZcDmDeR62bW+87dg9CFWXvHrFSHCoCnQgir9fQyua3XFEdm7fvXLY nS5av1byEw2iPdIWlaMCnjqsFl0eDNKxrIuKXslYMhU+OMh3soVse4RmQ7QW Xcx7FwpaqQj0QjRxdK1cIMlP8PzPC54.yplriU7brzwqs1gjnow4n3x+Eh38 O1UaSIuF+D1OWe2zLd6JaH8MIZxs0K8sYlNyRg+KWVuo60.7E6akYkmjafNz Zl400n3+jzL9Y9X2mUuRCm3i05jtLAbxBm5dXo8SEbh6uF6wZ6EeVbdH6O3w yTZWg3d3+a++hiLV7KkespyzdYTXFqZ3DcJPMIjbRXdgcJmjKxoTTTfxyaPT KJZTFUdrDtn.C+qqnkuiJJ9JpHyjWV7Kq29zpB -----------end_max5_patcher-----------

one way oif many would be to use random and then map the output to the notenumbers stored in a coll.

fill the first 12 slots of a table with your weights and bang it to generate a weighted random.

Thanks everybody.

Christopher – thanks for the reminder about algocomp – that article made a lot clear to me, as well as introducing a use of itable that I didn’t know!

I had a quick look through the following posts, but couldn’t see the one about using Markov chains to "melodify" the results. Have you written that? Or is there maybe a draft version I could look at? And the one about synchronous decision making?

Thanks

David

A forum search also turned up a lnk to Markov chains on Algorithmic Composer –

http://algorithmiccomposer.blogspot.com/2010/05/algorithmic-composition-markov-chains.html

Forums > MaxMSP