random thoughts

No, the image above is not my latest Max patch, though I can think of a few people who might recognise something there.

Not Max: Lisp.

If you’ve heard me talk about algorithmic composition then you’ll know that I’m no fan of randomness in musical structure. A bold statement, prone to generate sneers, no doubt. So let me contextualise that. There’s a place and case for randomness of course, as Xenakis and others have made abundantly clear. Plus, there are many times where rigorous deterministic structuring cannot be distinguished from randomness. So let’s start by singing its praises. In his engaging new book, Music of Possibility, composer Richard Barrett has made a positive case for techniques involving random choice. In particular, and to paraphrase Richard, the reason you might use statistical techniques is that they are well suited to dealing with a large number of elements, a context in which the use of deterministic procedures can lead to diminishing musical returns. The deterministic examples I derive below were made as a response to this, and address in particular Richard’s description of Pitch Focus, or randomly varied heterophony. They hopefully illustrate increasing musical returns—or at least the beginnings of such—without straying too far from the paradigm of random variation.

Now to the case against. Particularly when teaching, I tend to pull a face when randomness is used for want of a better idea, especially when the randomness itself is not structured 1 and/or where the result of a random choice is a clearly perceivable unit 2. The point I usually make about randomness is twofold:

  1. Given the code->generate->evaluate development loop that much algorithmic composition involves, randomness can create problems in that it is by definition non-repeatable. Certain features generated by a random procedure during one pass may be missing the next time the structure is generated. Of course, this may be exactly what you need, or perhaps your development cycle involves more editing by hand than regeneration of results, so repeatability is not an issue. More to the point, fixed-seed randomness is easily achievable and by its very nature offers the same sequence of results  each time it is re-seeded and re-started, so repeatability is not the real issue.
  2. The use of un-nuanced randomness is a missed opportunity for structure: something that a listener could recognise and appreciate as a pattern is passed over for something that is by its very definition uninteresting. This is the real issue, for me.

When I make these general points I’m usually asked, quite fairly of course, Well, what’s the alternative? There are many, including deterministic algorithms which model nature, such as Lindenmeyer Systems or, also in my algorithmic composition software slippery-chicken, things such as Fibonacci transistions, the hailstone algorithm, activity-levels, cellular automata such as Wolfram Codes, the procession algorithm, or, hot-off-the-digital-press, my Alternative for the Undecided or AFU 3

AFU is a deterministic alternative to randomness that can be used to create audible structure. Essentially it inflates a list of proportions into longer lists by scaling the proportions by permutated pairs of themselves. By default it uses an activity-levels object 4 to generate the proportions which then after inflation are scaled, either linearly or exponentially. The basic object will create a circular list of 408 floating-point numbers ranging between 0.0 and 1.0. These tend to cluster towards the bottom, hence the possibility of scaling them exponentially. Such scaling of course destroys the strict proportional relationships but, hey-ho, it’s  a numbers game and it’s patterns we need, not the holy trinity or music of the spheres. OK, that’s a little glib, but the point is that these numbers create recognisable but changing patterns, however they’re scaled.

Because this is all harder to describe in words than to demonstrate in sound I’ve created a few examples inspired by Richard Barrett’s idea of randomised pitch focus. This is Common Lisp code, using my slippery chicken software. First of all, a helper function:


;;; arguments: a list of pitch symbols
;;;            the level slot for the activity-levels object (5 = 50/50%)
;;;            the minimum transposition (semitones)
;;;            the maximum transposition
;;;            the exponent to raise AFU data to (NIL = linear)
;;;            the MIDI file path
;;;        |||| OK, I'm going too far with the political metaphor :/
(defun afu-demo (pitches level min max expt file)
  (let* ((afu (when level (make-afu :level level :minimum min :maximum max
                                    :exponent expt)))
         (ps (make-cscl (init-pitch-list pitches nil 1 2)))
         (events (loop repeat 300 collect
                      (make-event (transpose (get-next ps)
                                             (if level
                                                 (get-next afu)
                                                 (between min max)))
    (events-update-time events)
    (event-list-to-midi-file events :start-tempo 136 :midi-file file)


Now five different calls generating the  following five audio snippets, beginning with pure randomness:

;; pure random deviations a minor third above and below middle A
(afu-demo '(a4) nil -3 3 nil "/tmp/afu0.mid")

;; AFU deviations of the same
(afu-demo '(a4) 5 -3 3 nil "/tmp/afu1.mid")

;; sim. but with a lower 'level' thus higher proportions
(afu-demo '(a4) 3 -3 3 nil "/tmp/afu2.mid")

;; and again but exponentially scaled for less repetition at the beginning
(afu-demo '(a4) 3 -3 3 0.3 "/tmp/afu3.mid")

;; all rise!
(afu-demo '(a4 a4 b4 gs4 a4 b4) 3 -1 1 0.3 "/tmp/afu4.mid")

;; more random you say? well, not quite
(afu-demo '(a4 a4 b4 gs4 a4 b4) 2 -6 6 0.1 "/tmp/afu5.mid")


Now if that little bit of periodicity or redundancy is too much for you, then by all
means embrace the randomness and I’ll embrace my boredom when I listen to it. 😉



  1. E.g. in Xenakis’s stochastic techniques or in the use of Markov Chains/weighted randomness to choose from more or less likely outcomes given any current status
  2. E.g. the selection of a single note in an unaccompanied melody as opposed to the selection of a note in the context of a cloud of hundreds of notes with certain aggregate leanings
  3. It’s EU Election time 2019 and I live in Germany; please forgive the silly acronym.
  4. Essentially a deterministic and pattern-generating alternative to a coin or dice toss
Share Button

← Previous post

1 Comment

  1. random and pseudo-random processes can help quickly create a blurry image of an idea. Once the idea reveals more of itself, the feedback to tweak and refine the image begins. But sometimes a blurry image is what you look for. My code sometimes has random functions in the first versions of the projects, and they are replaced by more “thought through” processes later on. Mixing a little bit of both also gives nice results. These are nice examples, thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *