Traditional music composition is "linear", meaning that all of the musical elements are arranged in a specific sequence over time. Most (but not all) of what we have seen in the assignments is linear in the same sense, because the musical materials are prearranged in a certain way. Some of you have incorporated "small" amounts of randomness in your pieces, so that details might change for each rendition of the piece, but in general, the overall musical structure has been quite fixed. For this assignment you will "compose" in a different way, using some kind of random or nondeterministic element. Your assignment is to write a Lisp program that will output a different piece each time it is run. In a sense, by writing this program you will be composing a (possibly infinite) collection of related pieces. Do not simply select randomly from a small set of totally predetermined outputs, like this: (defun fail-this-assignment () (let ((r (random 2))) (if (< r 1) (piece-number-one) (piece-number-two) ))) Here are some randomness-generating elements you can work with: - Common Lisp's RANDOM function, the most low-level random number generator. (http://ccrma.stanford.edu/courses/220b/cltl/clm/node133.html) - CM's RAN function (http://ccrma.stanford.edu/software/cm/doc/dict/ran-fn.html), which supports lots of statistical distributions. - The HEAP and RANDOM classes of Common Music Patterns - State Machines (http://ccrma.stanford.edu/courses/220b/topics/randomprocesses) - Markov chains You should also consider these issues: - Which elements of your piece will be fixed and which will be left to chance? What will all of the outputs of your program have in common? - How can you ensure "good" results without painstakingly evaluating every possible random outcome? Consider using predicates and conditionals to have your program "test" its own output for certain criteria, and keep trying if it doesn't "like" what it's doing. For example, you could generate random melodies with a heap or random pattern, but then check to make sure that the resulting melodies follow certain rules. (For example, "any melodic leap of more than a fifth must be followed by melodic motion in the opposite direction.") If a randomly-generated melody fails the test, the program would throw it out and generate a new one. As always, your submission should be in the form of a working web page with an explanation of what you did and with working links to a working sound file and working Lisp code.