Thursday, December 29, 2011

Alarm Clock Blues (Rhythmic Congruences)

The first piece I wrote on my computer with the intention of having it played by humans (it never was) was called Alarm Clock Blues.

I've been a drummer all my life so, to me, tonality is simply the vertical axis that makes my rhythmic grid two-dimensional. I've grown to appreciate and respect great writers of pitch-focused music, but I realize that I will never be able to write a good melody on purpose, nor will I be able to build and release tension with pitch alone, and therefore any interesting melodic properties of my music are a product of some rhythmic function I'm generating the sounds with, and are not of my own design.

Alarm Clock Blues by Rhythmic Mathematics Blog

The structure of Alarm Clock Blues is straight forward: A B A. Nothing of relevant interest happens in the A's, nor in the bridge between B and the second A. However, the B section is an illustration of the first rhythmic mathematical concept I want to discuss in this blog.

The piece is written for four pianists. The idea of the B section is as follows: one player plays a 6 beat pattern, the next plays the 6 beat pattern + 1 more beat, the next plays the 7 beat pattern + 1 more beat, and the last player plays the 8 beat pattern + 1 more beat.


If you're unfamiliar with piano roll notation for music, it's very easy to understand. The height of each note corresponds to its pitch (in Reason the y axis is a piano for quick reference) and the width of each note corresponds to its duration. For this section, the grid is 16th notes. The x-axis is time and it intuitively runs left-to-right.


The 6 beat pattern:

The 7 beat pattern:


The 8 beat pattern:


The 9 beat pattern:

Ever the lazy composer, all I did at this point was duplicate these patterns end to start until they all ended at the same point in time. Of course, being lazy, I didn't want to keep checking after every duplication to see if everything was lining up so I needed the answer to the following question: how many repetitions of each would I need to re-synchronize all of them?

The key to answering this question is considering each pattern as a block. This idea should appeal to your inner toddler. The width of the block is the number of beats in the pattern.  Visually, if you lay all the blocks used in the B section on top of each other you get the following structure (click image to expand):


The structure stacks 6-blocks upon 7-blocks upon 8-blocks upon 9-blocks. You may start to notice patterns already, but for clarity, here is the same image with only X-congruences (where X is the number of blocks start at the same point on the x-axis) highlighted:


As desired, there are only two 4-congruences, one the first and last beat of the structure.

Now the following observation can be made:

After every seven 6-blocks and every six 7-blocks there is a congruence between 6- and 7- blocks. In other words, if you play the 6-block pattern seven times and at the same time play the 7-block pattern only six times, you'll be in the same place in time. The same is true for every for 7- and 8-blocks, 7- and 9-blocks, and 8- and 9-blocks.

7-blocks stacked on 8-blocks

The following rule can be proposed based on the above observation: 
If you have an x-block and a y-block, where x and y are natural numbers (integers greater than 0), 
then for every x y-blocks and every y x-blocks you will have a congruence between the x- and y-blocks.

This reason this rule is not good enough for my needs is illuminated when stacking 6- and 8-blocks.

6-blocks stacked on 8-blocks

While there is a congruence after six 8-blocks and eight 6-blocks (the third 2-congruence highlighted above), there is also a congruence after three 8-blocks and four 6-blocks (the second highlighted 2-congruence.) In fact, if you didn't know that you were stacking 6- and 8-blocks, you would guess that this was a 3- on 4-block stack, since they look exactly the same without the context of the underlying grid.

Similarly, upon examination, there is certainly a congruence after nine 6-blocks and six 9-blocks, but there is also one after three 6-blocks and two 9-blocks.

So what makes the 6-8 block stack and 6-9 block stack different than the 6-7, 7-8, 7-9, and 8-9 block stacks? If the answer is not immediately clear, try to remember your 6th grade math class and the "greatest common divisor." The greatest common divisor, often referred to as gcd, of non-zero numbers is the largest positive number that divides the numbers without a remainder.

Ex.
   gcd(4,6) = 2 (Read "the greatest common divisor of 4 and 6 is 2")
Ex.
   gcd(5,3) = 1
Ex.
   gcd(4,8,12) = 4

Let's look at gcd's of our pairs:

gcd(6,7) = 1
gcd(6,8) = 2
gcd(6,9) = 3
gcd(7,8) = 1
gcd(7,9) = 1
gcd(8,9) = 1

We previously saw that there is a congruence of 6- and 8- blocks after four 6-blocks and three 8-blocks, and it is not coincidence that 6/gcd(6,8) = 6/2 = three and 8/gcd(6,8) = 8/2 = four. Also we see in the case of 6- and 9-blocks that 9/gcd(6,9) = 9/3 = three and 6/gcd(6,9) = 6/3 = two.

Note: if gcd(a,b) = 1 for any two non-zero a's and b's, then it is said that a and b are relatively prime, or coprime. I will be using this terminology in future posts.

Of course once you start remembering the greatest common divisor, the phrase "least common multiple" (abbreviated lcm) should start ringing in your ears. The least common multiple of some numbers is the smallest number divisible by all the numbers you're looking at. The least common multiple is what will lead us to the answer of our congruence question.

This brings us to the first conclusion I will propose on this blog, and though the proof is somewhat trivial, I will save it for a future post.

1st Polyrhythm Postulate
Given an x-block and a y-block,
where x and y are natural numbers,
a congruence between the x- and y-blocks exists after:
  
(lcm(x,y)/x) x-blocks and (lcm(x,y)/y) y-blocks.

This accounts for the case when the gcd of a pair is not equal to 1, but since 
you can take the lcm of multiple numbers, the postulate can be generalized.


1st Polyrhythm Postulate (Generalized)
Given an a1-block, a2-block, ... , ai-block (for some natural number i),
where a1, a2, ... , ai are natural numbers,
if some natural number L = lcm(a1,a2,...,ai),
then a congruence between all blocks exists after:
(L/a1) a1-blocks, (L/a2) a2-blocks, ... , and (L/ai) ai-blocks


Now I can finally answer my lazy composer question:
how many repetitions of 6-, 7-, 8- and 9-blocks would I need to have a congruence?

Here L = lcm(6,7,8,9) = 504

Therefore, my so dearly sought after 4-congruence exists after:

(504/6) = 84 6-blocks
(504/7) = 72 7-blocks
(504/8) = 63 8-blocks
(504/9) = 56 9-blocks


I am reminded of xkcd 974:



Such is the way of all good extensible ideas.




No comments:

Post a Comment