User:Natasa Siencnik/prototyping/markov: Difference between revisions
Line 15: | Line 15: | ||
=====Python : Script 2011-05-23===== | =====Python : Script 2011-05-23===== | ||
<source lang=" | <source lang="python"> | ||
#!/usr/bin/env python | #!/usr/bin/env python | ||
Line 27: | Line 27: | ||
# pick a random VALUE from the list that belongs to the key | # pick a random VALUE from the list that belongs to the key | ||
# asign this next tone to start this loop again | # asign this next tone to start this loop again | ||
MIDGE | |||
#l2/d3: ["l2/a3", "l2/c+3"] | #l2/d3: ["l2/a3", "l2/c+3"] |
Revision as of 09:59, 24 May 2011
The Art of the Fugue
MARKOV CHAIN WITH J.S. BACH
Concept
Scripting Progress
Python : Script 2011-05-23
#!/usr/bin/env python
import random
nexttone = {}
nexttone = {"l2/d3":["l2/a3", "l2/c+3"], l2/a3: ["l2/f3"], l2/f3: ["l2/d3", "l8/f3"], l2/c+3: ["l4/d3"], l4/d3: ["l4/e3"], l4/e3: ["l2/f3"], l8/f3: ["l8/g3","l8/e3"], l8/g3: ["l8/f3"], l8/e3: ["l2/d3"]}
# start with first / one tone (KEY) in the dictionary
# look in the list of the KEY to find next possibilities
# pick a random VALUE from the list that belongs to the key
# asign this next tone to start this loop again
MIDGE
#l2/d3: ["l2/a3", "l2/c+3"]
#l2/a3: ["l2/f3"]
#l2/f3: ["l2/d3", "l8/f3"]
#l2/c+3: ["l4/d3"]
#l4/d3: ["l4/e3"]
#l4/e3: ["l2/f3"]
#l8/f3: ["l8/g3","l8/e3"]
#l8/g3: ["l8/f3"]
#l8/e3: ["l2/d3"]
Python : Script 2011-05-24
Useful Links
http://en.wikipedia.org/wiki/The_Art_of_Fugue
http://pzwart3.wdka.hro.nl/wiki/Poetry_generators
http://pzwart3.wdka.hro.nl/wiki/Sedsongs#midge