## Figure, Mobile Music, and Mathematical Rhythm Theory

When I started playing with Propellerheads’ Figure app recently, I had a case of rhythmic déjà vu. I heard highly syncopated rhythms somewhat like the bell and clave patterns of African and Latin music but also some stranger and more modern timelines. Figure is an electronic music making app, so the patterns were rendered in the sonic vocabulary of techno and house music, but the spiraling, endlessly-forward-falling clave rhythms were unmistakable. The Aka pygmies of Central Africa were in the club.

Smuggling African bell patterns into a mass-market, automatic techno app could be a prank pulled by a frustrated ethnomusicologist turned software developer, and part of me would like to believe that. But my hunch is that Figure’s predilection for off-kilter rhythms falls out of the mathematics of Figure’s interface design. That math traces its ancestry back to Euclid and has found applications, sometimes deliberate and sometimes not, in particle accelerators, string theory, Western scales, and African rhythm. What these cases and Figure have in common is patterns distributed as evenly as possible.

Imagine that you have 16 small boxes arranged in a circle and you are given five balls to place in the boxes. Only one ball can fit in a box, and the balls should be spread out as far from each other as possible, as though some repulsive force existed among them. If you follow these simple rules, there is only one pattern that can result. If we unroll the circle of boxes and lay them out in a line, they look like this:

[O][ _ ][ _ ][O][ _ ][ _ ][O][ _ ][ _ ][ _ ][O][ _ ][ _ ][O][ _ ][ _ ]

Where we start unrolling the circle of boxes is an arbitrary decision, so there are 16 variants of this pattern, each one starting at a different box, but in each case the pattern of distances from each ball to the others would be the same. OK, we have some balls in boxes, so what? If you imagine that each box represents a duration of one 16th note, and each ball is a clave note, you have the Bossa Nova pattern. The rhythmic foundation of Jobim and The Girl from Ipanema materializes out of a few simple rules. And if you move just one of the balls left or right and again interpet the pattern as clave strikes in a loop of 16th notes, you can generate the Cuban *Son*, the *Gahu* pattern of the Ewe, and the *Rumba*.

These bell and clave patterns demonstrate a quality that music theorists call *maximal evenness*, the property of events being evenly distributed (or nearly evenly) among a discrete set of locations. Much of what we know about clave patterns and the mathematics of maximal evenness comes from the research of Canadian computer scientist Godfried Toussaint, a polymath whose research spans “computer vision, visualization, computer graphics, computer-aided design, automated manufacturing, knot theory, polymer physics, and computational biology.” Since 2003, Toussaint has focused his research on the “computational musicology” of clave rhythms. Prior to Toussaint, ethnomusicologists such as Simha Arom and David Locke had offered insights into what makes certain repeated rhythms captivating, but Toussaint brought rigor, computational chops, and historical perspective to the topic, which brings us back to Euclid.

As Toussaint writes in his 2005 paper, Euclid’s *Elements* treatise, published around 300 B.C., describes a simple but non-trivial algorithm for computing the greatest common factor of two integers. Here’s how it works. Given two integers, subtract the smaller number from the larger until what started as the larger becomes zero or the larger becomes smaller than the smaller. If the larger reaches zero under (repeated) subtraction, you’re done. The greatest common factor is the smaller number. If the larger number becomes smaller than the smaller after subtraction but is not zero, swap the small number with the now even smaller number, and repeat the whole operation. Eventually, subtracting the smaller from the larger will reach zero, and you’ll have your answer. Toussaint summarizes the algorithm in pseudo-code:

Let

mandkbe the input integers withm>k.

`EUCLID(m;k)`

1. if k = 0

2. then return m

3. else return EUCLID(k,m mod k)

This algorithm can generate maximally even patterns like the Bossa Nova clave if we interpret the algorithm spatially. Instead of balls in boxes, let’s represent clave hits with a ’1′ and empty durations with a ’0,’ and to simplify matters, instead of 16 possible locations we’ll use 8. Let’s place our 1s and 0s in a line with the 1s on the left and the 0s on the right.

`1 1 1 0 0 0 0 0`

Now we apply `EUCLID(5,3)`

and, when we subtract 3 from 5, we move three 0s behind each of the 1s. After moving these three 0s, we group them with their neighboring 1s in square brackets. And we’ll put square brackets around the remaining 0s to show that we now have five sequences–three sequences of [1 0] and two sequences of [0].

`[1 0] [1 0] [1 0] [0] [0]`

We started with eight singlet sequences, three of 1 and five of 0, and now we have five total, three of [1 0], and two of [0]. Applying the algorithm once again, this time calling `EUCLID(3,2)`

, and interpreting the process spatially by interpolating the smaller sequences with the larger ones, yields

`[1 0 0] [1 0 0] [1 0]`

If you treat each position as an eighth note and each 1 is an onset, congratulations, you’ve generated one of the most popular rhythms ever invented. This rhythm, Toussaint writes

is none other than one of the most famous on the planet. In Cuba it goes by the name of the tresillo and in the USA is often called the Habanera rhythm used in hundreds of rockabilly songs during the 1950’s. It can often be heard in early rock-and-roll hits in the left-hand patterns of the piano, or played on the string bass or saxophone [7], [15], [22]. A good example is the bass rhythm in Elvis Presley’s Hound Dog.

Don’t believe Godfried? Listen to the guitar (it’s easier to hear than the bass) in this live performance of Hound Dog.

Like Elvis, maximally even Afro-Latin rhythms live on, often in surprising places. Figure, the mobile dance music app from the Swedish software developer Propellerheads, uses maximal evenness as the guiding principle in generating its dance beats. The motivation for using maximal evenness wasn’t, I don’t think, an affinity for computational ethnomusicology; rather, some interpretive schema was necessary for converting input from a highly simplified user interface into specific rhythms, and the Euclid algorithm can do that. Figure was conceived as an app for the consumer market, not professionals, and consequently it tossed out the step sequencer interface that has been a hallmark of beat making apps because using a step sequencer requires some skill and it monopolizes the entire screen.

Figure needed rhythm controls with the opposite characteristics: the controls had to be economically sized, and they couldn’t allow you to do something that sounded bad. The solution Propellerheads’ designers hit upon was to use a single control for each percussion instrument. This control changes the number of notes played by that instrument in every bar; it’s like a rhythmic density throttle. In the image at right, you see the controls for the kick, snare, hat, and cowbell, and the number of the circle represents the number of notes that each instrument can play in a measure (users have the opportunity to select only a subset of possible notes by pushing the buttons below the circle, but we’ll ignore this possibility to simplify matters).

The user can tell Figure *how many* notes to play in a measure, but the app has to decide *which* notes to play. It decides with the Euclid algorithm. When you tell Figure to play three snare hits per bar, it plays three hits distributed as evenly as possible among the 16 16th notes in a bar of 4/4. When you tell it to play five hits in a bar, it spaces those five hits out in the pattern we discovered in the balls-in-boxes exercise. Figure lines up beat 1 with a different part of the pattern, resulting in four dotted eighth notes followed by a quarter note, but the spacing is the same. It’s the Bossa Nova pattern begun on a different note. Every time you tell Figure to play X notes in a bar of 16 sixteenth notes, it calculates `EUCLID(16,X)`

.

Condensing the controllable rhythmic parameters to one number per instrument obviously saves space, but why do these maximally even rhythms sound good? I tried to answer that question in a paper presented at the 2008 International Society of Music Information Retrieval conference. (Full disclosure: I met Godfried Toussaint at the conference, and I thought he was a congenial as well as very smart guy). My argument was that maximally even rhythms in which the number of notes does not evenly divide the number of locations, for example 5 in 16 and 3 in 8, are easy to hear and re-hear in a variety of metrical contexts. Like the gestalt flip that occurs when you look at foreground-background illusions (is it a vase or is it two faces? etc.) the metrical ambiguity of maximally even patterns offers our brains opportunities to re-experience the same thing in a new way. That’s why these rhythms can stay interesting when repeated over and over.

That, anyway, was the theory. The paper didn’t set the world of computational musicology ablaze, so discount accordingly. What was interesting to me was that a mathematical theory of rhythm that is normally discussed at obscurantist academic conferences had been directly implemented in a mass market product. Furthermore, the success of Figure in entertaining millions of people who are not musicians offers further proof that these are indeed a special class of rhythms. I’ll close with a video I made a couple days ago of me using Vio with Figure. Enjoy the syncopated maximal evenness in the hi hat.

## Comments

No Comments

## Leave a reply