Notes on polyrhythms

A polyrhythm is a sequence of two or more rhythms played simultaneously, but not all two rhythms create a polyrhythm in the strict sense of the term, and this is because (1) each rhythm has to be spaced evenly within the same time cycle (think tuplets), and (2) the number of onsets in rhythm A cannot be divisible by the number of onsets in rhythm B.

The result can be perceived as two overlapping meters played at different speeds, but unlike polyrhythms that share a common factor, like 6 against 3, polyrhythms comprised of conflicting rhythms require some additional steps.

The first step is to find the least common multiple of the two integers, which in the case of 3 and 2 is 6, so 6 is the common subdivision of 3 and 2. One way to convey this relationship visually is to align both rhythms in a tabular layout, distributing each of the three onsets in the first row every two cells, and each of the two onsets in the second row every three cells, like so:

x.x.x.
x..x..

Below is a set of functions to generate these tables, which may be useful for representing polyrhythmic structures in general, but is no substitute for the experience of participation. Either way, you’re invited to experiment with the source code of this page.

(defun polyrhythm-row (n lcm)
  (let (list)
    (dotimes (i lcm)
      (if (= (% i (/ lcm n)) 0)
          (push "x" list)
        (push "." list)))
    (nreverse list)))

(defun polyrhythm (&rest args)
  (let* (list (args (flatten-list args))
              (lcm (apply #'cl-lcm args)))
    (dolist (i args)
      (push (polyrhythm-row i lcm) list))
    (mapconcat #'string-join (nreverse list) "\n")))

(polyrhythm args)

Now here are some polyrhythms I like, in order of difficulty.

x.x.x.x.x.
x....x....
x..x..x..x..
x...x...x...
x..x..x..x..x..x..x..x..
x.......x.......x.......

In particular, here’s what a 7 against 6 looks and sounds like using beats to generate the audio file.

x.....x.....x.....x.....x.....x.....x.....
x......x......x......x......x......x......

Now using multiple voices:

x.x.x.x.x.x.
x..x..x..x..
x.....x.....
x.x.x.x.x.x.x.x.x.x.
x...x...x...x...x...
x....x....x....x....
x..x..x..x..x..x..x..x..
x.......x.......x.......
x...........x...........
x.....x.....x.....x.....

Here’s what a 6 5 4 3 2 over 2 3 4 5 6 polyrhythm looks like:

x.............................x.............................
x...................x...................x...................
x..............x..............x..............x..............
x...........x...........x...........x...........x...........
x.........x.........x.........x.........x.........x.........
x.........x.........x.........x.........x.........x.........
x...........x...........x...........x...........x...........
x..............x..............x..............x..............
x...................x...................x...................
x.............................x.............................

And here’s what a 1 1 2 3 5 8 over 8 5 3 2 1 1 looks and sounds like using random sine waves. Listen carefully.

x.......................................................................................................................
x.......................................................................................................................
x...........................................................x...........................................................
x.......................................x.......................................x.......................................
x.......................x.......................x.......................x.......................x.......................
x..............x..............x..............x..............x..............x..............x..............x..............
x..............x..............x..............x..............x..............x..............x..............x..............
x.......................x.......................x.......................x.......................x.......................
x.......................................x.......................................x.......................................
x...........................................................x...........................................................
x.......................................................................................................................
x.......................................................................................................................

Polyrhythms are fascinating, but explanations about them usually assume that both rhythms start together. What if one rhythm is shifted forward or backward? The onsets may or may not collide depending on how the rhythm is shifted, but this would still produce equally valid polyrhythms as far as I can tell, and even if they look and/or sound similar, there is still considerable difference in how they are felt. Either way, I still have a long way to go to tame some of these polyrhythms, but let’s move on anyway and put this to the test. Here I’m shifting the 2-row forward by 1 step.

(defun polyrhythm (&rest args)
  (let* (list (args (flatten-list args))
              (lcm (* (apply #'cl-lcm args) n)))
    (dolist (i args)
      (push (polyrhythm-row i lcm) list))
    (nreverse list)))

(defun rotate (n list)
  (let* ((len (length list))
         (n-mod-len (mod n len))
         (new-tail-len (if (> n-mod-len 0)
                           (- len n-mod-len)
                         n-mod-len)))
    (append (last list (- len new-tail-len))
            (butlast list (- len new-tail-len)))))

(let ((list (polyrhythm args)))
  (mapconcat #'string-join
             (append (list (rotate top (car list)))
                     (list (rotate bot (cadr list))))
             "\n"))

And now I’m shifting it forward by 2 steps:

x.x.x.
..x..x

It turns out both rhythms always meet at one point in time, but what if we used some smaller subdivision? For example, there were 6 units in the previous example, and now I’m using 12:

x...x...x...
.x.....x....

Well, there you go. Now we have two evenly spaced rhythms that never collide. Is this still a 3 against 2? I think it is, but divided in 12 units and with the 2-row shifted forward by one unit. Just some thoughts. Let me know yours.

🏷️ music programming