Using Prime Durations for Unpredictable Soundscapes
I was enthralled the other day when my walk was abruptly stopped by the sound of over one-hundred red winged blackbirds perched in a tree. If you are familiar with the bird, you know what a distinctive racket they make, including short quiet chirps interspersed by noisy trills.
Over two-hundred of them create an interesting cacophony, where a cloud of chirps and trills create a sound that is very unique that both resembles the original birds' song and yet something not quite classifiable. There is a structure in the whole that doesn't quite relate to the structure of the parts, at least that was my perception.
I have always found the 13- and 17-year breeding cycle of periodic cicadas fascinating. Cicadas survive by spawning millions of nymphs and overwhelming the appetites of potential predators. The prime length breeding cycles are the subject of a number of hypotheses. One ideas is that this duration is a way of either selecting for broods that are not synchronized to broods of predator species. Another idea is that prime duration cycles prevent hybridization with other broods during the harsh environments in which they initially found themselves.
What I find most fascinating here is how prime numbers prevent predictable cycles. In a lot of music, predictability is ensured by deploying cycles the either are not prime (4, 6, 8, 9 and 12) or are the first two primes 2 or 3. Using prime durations, however, make the onset of any note event unpredictable.
When I was a pianist fascinated by Messiaen, I learned "Première communion de la Vierge" from his Vingt Regards Sur L'Enfant Jésus for solo piano. One interesting passage occurs in which Messiaen intersperses prime numbers within a series of quarter notes, creating a sense of disjointedness in an otherwise rhythmically strict composition. Nevertheless, the ritardando sounds rather natural for being so synthetic.
Prime Durations in a String Quartet about Florida
People from Florida know that undeveloped lands and state parks are full of all kinds of nature. Some of it is pleasant.
I'm working on a string quartet about how Florida is emblematic of our current (2025) state of decay. One movement uses prime durations articulated by pizzicato sounds. I am using the python programing language to put this together (as doing so gives me a ton of libraries allowing me to do things like apply machine learning, web scraping, music theory, audio analysis, and so on). Starting out, I am using the dawdreamer library with SWAM solo strings. (I might not put this in front of human players, to be honest. I'll explain my thinking later.)
An initial sketch used the following function, which sequences a set of prime durations repeatedly. Each voice gets an offset within a sequence of these primes. The numbers are 2, 3, 5, 7, 11, 13, 13, 11, 7, 5, 3, 2:
def dur_generator1(offset=0):
durs = [2, 3, 5, 7, 11, 13]
durs = durs[offset:] + durs[:offset]
while True:
for d in durs:
yield d/5
for d in reversed(durs):
yield d/5Here is what it sounds like:
This is somewhat unpredictable, but gets old quickly. Partly this is because the length of the sequence is 82 fifths of a second or 16 seconds.
One of the simplest ways of creating interest in algorithmic music is to simply add dynamics. I used this function to fade dynamics in and out:
def vel_generator(min, max, n=10):
vels = np.linspace(min, max, n)
while True:
for v in vels:
yield int(v)
for v in reversed(vels):
yield int(v)I also use a bit of code instructing each instrument to skip a number of the first velocity values so they are not correlated:
for i in range(i*4):
next(vels)This is the result:
Interestingly enough, this also isn't that interesting. To test whether this was a case of bad performance or bad composition, I automated pitch bend, tone, and bow position parameters of the audio plugin (which is a physical model) using a Perlin Noise library. Here is that result:
I like this, but it is a bit too "musical" for me. The sudden accents and the disconcerting pizzicati remind me of the nasty biting insects one encounters as the walk through a dark Florida swamp. The focus on a duration base of one-fifth of a second, however, makes the piece groove too much to enable the music to give that much offense, which is the goal of course.
This code for generating durations had a satisfactory result:
def dur_generator(offset=0):
durs = [2,3,5,7,11]
durs = durs[offset:] + durs[:offset]
while True:
for num_dur in durs:
num = 13/num_dur
for d in durs:
yield num/dI played the result on a balmy evening just outside of a pine wood as I imaged the Rosette Nebula while being feasted on by the mosquitos. When I played this, a deer snorted nearby, running off into the distance. continuing to huff and snort to warn his companions.