The Bjorklund Algorithm

The following problem is considered by Bjorklund, in connection with the operation of certain components (such as high voltage power supplies) of spallation neutron source (SNS) accelerators used in nuclear physics.

Construct a binary sequence of n bits with k one’s, such that the k one’s are distributed as evenly as possible among the zero’s. For example, if n = 16 and k = 4, the solution is [1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0]. The problem of primary interest is when k and n are relatively prime numbers, i.e., when k and n are evenly divisible only by 1.

This is an excerpt from the somewhat melodramatically titled paper, The Euclidean Algorithm Generates Traditional Musical Rhythms. In short, sequences generated by the equal spacing algorithm described resemble various traditional rhythms, or otherwise sound pretty good. Create Digital Music did a post on various musical applications of it recently, like this neat little sequencer in flash.

Being a SuperCollider chauvinist I was happy to see Fredrik Olofsson had already written a pattern class to generate these sequences. It didn’t support embedding of patterns within it (which is what I really wanted to play with) but after a quick email to the list he patched it. Thanks Fredrik.

Anyway, here is a quick demo, with code after the jump.

More »

Syncopation Exercise

After two or three years of halfheartedly playing with SuperCollider every now and then, I finally bothered to read the documentation for it’s language-side (as oppose to server-side) sequencing features. This is what most SC users are, for good reason, most enthusiastic about. It’s a very flexible and (as far as I know) unusual approach to the basic musical problem of ordering sound in time.

What follows is a very simple example an algorithmically generated piece with some constrained randomness. This isn’t meant to be a tutorial really, but should give you an idea of SC’s general character, and convince you that it’s worth the trouble to work through the documentation.

More »