In recent years there’s been a fair amount of interest in the synth community in Euclidean sequencers. These are trigger sequencers that let you specify a sequence length (number of steps) and a count of the desired number of triggers per sequence, and they then generate such a sequence with the property that the triggers are as evenly divided between the steps as possible. Usually there also is a rotate, or offset, control that shifts the start of the pattern to any other desired step in the sequence.

All this apparently goes back to a paper that rather breathlessly claims all commonly used rhythms in music worldwide — *except India! *— are Euclidean sequences, and it lays out an algorithm that is related to Euclid’s method for finding a greatest common divisor, hence the name. I’ve never actually used a Euclidean sequencer, and maybe if I did I’d feel differently, but just from reading about it I’m bemused by the interest. It automatically generates the world’s most commonly used rhythms? Ones as close as possible to a steady, unvarying beat? Only one possibility (modulo offset) for any combination of sequence length and number of events? This is supposed to be exciting?

Another option for a step sequencer, of course, is one that lets you specify individually which steps are off and which are on. Or one that just generates patterns randomly. But it does seem to me that something in between, that generates several possible patterns for each sequence length and number of events, with underlying structure and different amounts of uniformity, would be more interesting than either Euclidean or random sequences.

So I had an idea, and I’d be rather surprised if no one else has done it already but I’m not aware of it if so, or what they called it. I call it a gap sequencer.

There’s something in mathematics called the three gap theorem, which states

if one places n points on a circle, at angles of θ, 2θ, 3θ … from the starting point, then there will be at most three distinct distances between pairs of points in adjacent positions around the circle. When there are three distances, the larger of the three always equals the sum of the other two.

Wikipedia, “Three-gap_theorem“

This has applications to music: For instance, if you label a clock face with the names of the twelve notes of the chromatic scale, and then start with some note and add notes that are a (pure, not equally tempered) fifth, two fifths, three fifths … higher, then with more than three notes you usually get a scale with three sizes of gaps between consecutive notes, but the five, seven, and twelve note scales have gaps of only two sizes. And those are the familiar pentatonic, diatonic, and chromatic scales. The next two-gap scale is 17 notes, and isn’t familiar in western music, but about 800 years ago it was used as the basis of a treatise on middle eastern music theory. Interestingly, though, the three gap theorem wasn’t proved until the 1950s.

Here the clock face corresponds to an octave, wrapped around so its end coincides with its start; this is known as the period, while the fifth used to produce the scale is known as the generator. You can use other temperings of the fifth to produce different scales — for instance, a somewhat narrower fifth will produce a 19-note two-gap scale instead of the 17-note one. Generally you can keep adding new notes to the scales as long as you want, but if the generator is a rational multiple of the period, eventually you get an equal division of the octave and no new notes after that. For instance, if you use an equally tempered fifth as the generator, then the 12-note scale is equally spaced (a one-gap scale) and the next note you try to add just turns out to be the one you started with again.

What I realized was I hadn’t seen this applied to rhythms, where you ask not whether F, F#, G, G#, A… are in the scale or not but whether beats 1, 2, 3, 4… have a trigger or not. Using a period and a generator both equal to some integer numbers of steps, you can generate sequences whose length is the period. The period 12, generator 7, 7-event sequence analogous to the diatonic scale — C – D – E F – G – A – B C — would be

Now, this turns out to be some offset of exactly what you’d get from a Euclidean sequencer for length 12 and number of events 7. But we could also use a different generator. A generator of 1 would produce this much less uniform rhythm:

which, granted, isn’t very exciting, but at least it’s different.

It turns out that if the period and generator have a common factor, then the largest number of events you can get is the period divided by that common factor. So for instance, with a period of 12 and generator 2, you can get no more than six events, evenly spaced on alternate beats, and then if you try to add a seventh event it coincides with the first of the six. With generator 3 you can get no more than 4 events, with generator 4 you’re limited to 3 events, and with generator 6 you get two whole events. Furthermore, two generators that add up to the period give you the same sequences (up to an offset), so for a sequence of length 12, really 1 and 5 (or 11 and 7) are the only generators of great interest.

Fortunately, you’re more likely to want sequence lengths with fewer divisors than 12 has, namely powers of 2. For a 16 step sequence, generators 1, 3, 5, and 7 all are useful. Here’s length 16, generator 3, 9 events, 0 offset:

For a 32 step sequence, you can use generators 1, 3, 5, 7, 9, 11, 13, and 15, and so on.

For a sequence length that’s a prime number, like 31, you can use every generator from 1 to half the period — anything from 1 through 15 in this case. Unfortunately sequences of length 31 are a bit odd for most music. But you could cheat. If you send a reset to the sequencer every 32 steps it’ll generate the 31-step sequence, then repeat the first step, and then repeat all that. That’ll give you 15 possibilities for a 32-step sequence. (Some of them might have a fourth gap size, though!)

Without cheating, you do get at least two sequences, modulo offset, for every length greater than 6 and every number of events. ~~I suspect, though I haven’t really looked into it, that for every length and number of events there exists a generator that gives you the Euclidean sequence. And, if the length is anything other than 1, 2, 3, 4, or 6, there’s at least one more generator, usually more, that gives you a different, non Euclidean sequence.~~ *Edit: *The preceding conjecture is false. I stumbled across this counterexample though I’m confident there are simpler ones: For period 26 with 14 events, the Euclidean algorithm gives `[O-O-O-O-O-O-OO-O-O-O-O-O-O]`

(`O`

means a pulse, `-`

means no pulse). Two gaps of size 1 and twelve gaps of size 2. The gap algorithm does not give you that sequence (or an offset thereof) for any generator value. In fact the only two-gap sequence it produces is `[OOOOOOOOOOOOOO------------]`

, and perhaps the closest one to the Euclidean sequence is `[O-O-O-OO-O-O-OO-O-O--O-O-O]`

.

## One thought on “Gaps in the sequence, part 1”