Nuclear Powered Music
The “Gammaphone” Nuclear Music Box
I tell you: one must still have chaos within oneself,
to give birth to a dancing star. ~ Friedrich Nietzsche
Few things in life are as beautiful to me as a masterfully composed piece of music. I’m a fan of the classics – Bach, Vivaldi, Handel – virtually anything written by someone sporting a wig. You might even catch me enjoying something more modern on rare occasion. One thing is certain, though – there just isn’t enough GOOD music in this world. You can only listen to the same “favorites” playlist for so long until it starts to wear on your ears. Purchasing new music is expensive, and pirating it has nearly become a death penalty offense.
One solution to this problem is to write your own music. I’ve done my share of that, but you can never predict when inspiration will strike, and the doldrums in the interim can be maddening. This is the 21st century! There must be a more elegant solution.
Well I’ve discovered something interesting that I think warrants sharing. It seems the power of the atom is not limited to its ability to boil water and turn desert sand into glass. Radioactive isotopes also possess an equally mysterious and magical power… the power of randomness!
It turns out that it’s impossible to predict exactly when an unstable atom will spit out a subatomic particle. As a result, if you have a hot radioactive sample on hand and a Geiger counter that clicks when it detects a particle collision, you can slowly bring these items together and listen as the random clicks become more rapid, eventually morphing into a torrent of noise. Here’s what caesium-137 sounds like:
I could say that this sound is “music to my ears”, and there would be some truth in that. But it is more like a diamond in the rough, or a handful of earthen clay that has yet to be shaped by a sculptor. We should be able to sculpt this sound into something much more interesting and listenable.
Let’s borrow a few conventions from established Western music theory. We can start by adhering to a diatonic scale within a 12-tone pitch system. We’ll use the randomness of the radioactive sample to decide which white keys on our piano to play and when.
We can do this by using a microcontroller (a tiny computer chip) to measure the intervals between individual clicks. By comparing each interval to the one before it, we can generate a series of bits. If interval A is longer than B, we record a “one”, and if the converse is true, we record a “zero”. Repeat this eight times, and we have a byte of random data. Eight billion iterations will give us a gigabyte. There’s really no limit to the amount of random data that can be generated by this means.
Once we’ve collected as much data as we want, we can map these numbers to keys on the piano keyboard. Let’s see what happens.
Well that was interesting! But certainly not something I would trade in my copy of The Well-Tempered Clavier for. Let’s see if we can improve it.
It seems that many of these notes are not consonant. In other words, they clash with one another in ways that are displeasing to the ear. After doing some experiments with the piano keyboard as our laboratory, we discover that keys directly adjacent to one another usually do not sound very good when played simultaneously, but skipping a key does make for a nice sound. This time, let’s start by choosing a single note, then building a “chord” on top of it by playing the key that’s 2 notes up from it, and also the one that’s 2 notes up from that.
You may also notice that the “root” notes we chose weren’t completely random this time. We used a simple formula to determine candidates for strong chord choices relative to the prior chord, then we chose amongst the candidates randomly. The result is that the chord changes sound predictable, but not TOO predictable.
Now that we have a primitive system for generating chord progressions, let’s write a melody. Rather than choosing the notes completely randomly, let’s try using the random data to choose from a list of options according to a set of rules:
- If the note is at the start of a measure (the first of a group of 4 beats), it must be consonant. To make sure it is, we’ll just steal it from one of the three notes we already wrote in the chord progression. The random data can be used to decide which one – it doesn’t matter, since they all sound good together. All we need is a number between 1 and 3.
- Otherwise, we have 3 choices – we can go up one note from the previous pitch, we can go down, or we can just repeat the last note we wrote. Again, all we need for this decision is a number between 1 and 3.
- If we’re going to repeat a note, we may as well just tie the two consecutive notes together. This is a personal preference, but for me it has to do with separating essential harmonic rhythm from secondary (and arguably disposable) rhythmic elements. A great example of this is the difference between singing, “Happy Birthday, Dear Benjamin!” and “Happy Birthday, Dear Carol!” The notes are the same – how you split them up doesn’t really affect the value of the song.
- Save the pattern of note motion and repeat it several times throughout the piece, but follow the underlying chord progression and maintain the consonance rule.
Now let’s generate a chord progression and accompanying melody.
That’s finally starting to sound something like a song! But it’s still a bit too drab for my taste. To spice it up, we’ll try a technique called arpeggiation.
If we keep the chords we’ve written muted in the background, we can use the random number generator to decide which of their component notes to actually play. Yet again, all we need is a number between 1 and 3, since there are 3 chord notes to choose from. For a final touch, let’s just loop our arpeggiation pattern without looping the exact notes themselves. This will give each measure a similar rhythmic feel while still allowing the notes to follow the changing bassline.
Well I’m pretty satisfied with where this is going… If Cecilia Bartoli were to sing this song (substitute “Kelly Clarkson” if that name sounds unfamiliar to you…), it could be a hit!
But that’s not even the best part. We did a lot more than write a song here – we taught a machine to write a song. This machine can write thousands of these completely unique songs in a minute. Within an hour (conservatively), it could easily write more songs than you would ever have time to enjoy if you listened all day, every day for the rest of your life!
From my perspective, there’s just something fundamentally cool about creating something that creates. I can only write so many songs in the course of my lifetime, but knowing that I’ve created a machine that can go on writing new and original music until the heat death of the universe is a pretty satisfying feeling. In fact, I’m so overcome with joy that I could write a song about this! Better yet…
~ Gammaphone/tetraStream Videos ~
A reverse-chronological compendium of video snapshots of the project dating back to December, 2009! Some of these early attempts were fairly primitive. It has come a long way recently and a dedicated hardware device will soon be available for sale!
My friend Erik has a knack for getting me drunk, sticking a camera in my face and asking me to explain relatively complex subjects. It has become an amusing tradition for us. On one such occasion, he asked me to explain the Gammaphone. Watch that one at your own risk!
~ Hardware ~
The Gammaphone’s hardware currently consists of the following components (subject to constant tinkering):
- Caesium-137 disc source (10 microcuries) – emits ionizing alpha, beta & gamma radiation.
- SparkFun Geiger counter – detects radiation pulses; interfaces with microcontroller.
- Backlit serial LCD screen – displays relevant statistical and diagnostic information.
- SparkFun Proto Shield – allows permanent soldering of components.
- Arduino Duemilanove microcontroller – times pulses, gathers data and can either output data over USB for processing on the computer or perform the algorithmic composition functions itself, depending on configuration.
- Piezoelectric transducer – converts electrical impulses generated by pulses of radiation into audible clicks.
- Modern Device Fluxamasynth Shield (sometimes) – allows direct, realtime rendering of polyphonic audio without the use of a computer.
- RadMax lead shielding and galvanized steel cylinder – mitigates radiation exposure. Achieves 90% containment of radiation, including all alpha & beta emissions.
- Cigar box – houses components; releases pleasing aroma.
~ Software ~
I’ve been working on the Gammaphone’s underlying software algorithm for several years, improving it gradually through the discovery of new methods and rules. I dubbed it “tetraStream” after an interesting pattern I observed regarding the number four and its importance in music:
- Choral arrangements often feature four voice types (Soprano, Alto, Tenor and Bass, termed “SATB” arrangement).
- Popular songs are essentially chords and melody. A chord is comprised of three notes; add a melody and you have four voices. (I don’t count 7th chords and so forth because I’ve noticed that when they are employed, the melody almost always doubles some chord pitch if not the 7th itself, thereby keeping the relevant number of voices to four. Try playing a song that calls for a 7th chord and drop the “7″. The song will still sound just fine).
- Bach’s most challenging fugues are called 4-voice fugues.
- It appears that four different notes sounding simultaneously is about the limit for music to remain consonant, and it seems this number of voices is also the golden standard in both popular and classical music. Less than four voices can sound minimalistic, and more than four inevitably makes for unpleasant clashing.
- This is not to say that one cannot employ more than four instruments in an arrangement, but merely that regardless of the total number of instruments, there will generally be no more than four different note pitches sounding at any one time. Thus, arrangements with more than four instruments will generally involve a lot of doubling, where more than one instrument is playing the same note at any given instant.
The suffix “stream” is merely evocative of the endless stream of music the algorithm generates.
tetraStream does not require nuclear data to generate music. In fact, it has written quite a large volume of music using PRNG (pseudo-random number generator) data. The advantage of PRNG is that sequences can be easily re-generated on demand by simply seeding and seeking the PRNG to values previously employed. The advantage of nuclear is that all generated sequences are unique by default and are not likely to recur ever again.
Since the tetraStream software was written in ANSI C, it can be easily ported to different platforms and operating systems. Current implementations include firmware for the Arduino microcontroller that outputs realtime MIDI messages, and a version for Mac OS X that outputs MIDI files to the computer’s hard drive. For rendering MIDI to audio, I generally use the softsynths in Apple Logic. Sometimes I use a dedicated hardware device called the Fluxamasynth Shield.
I intend to one day make the software “open source”, but I have decided to wait until my other open source projects such as the AirHarp begin generating substantial revenue. I love the concept of the open source business model and I hope it proves compatible with my dream of designing and building cool stuff for a living.
In the mean time, I will soon begin selling archives of music generated by tetraStream, as well as a dedicated hardware device for electronic musicians that is currently being prototyped.
~ Acknowledgements ~
This project would not be possible without groundwork laid by John Walker’s “HotBits” system. The Macintosh version of tetraStream includes MIDI file export code by supergenius Michael Krzyzaniak, who has also provided invaluable guidance in the realm of music theory and other esoteric subjects. Special thanks to ejayerik and L.R.M. for steadfast support and encouragement throughout the years. And thank you Susan Voss for inducing me to finally document this project!
(cc) 2012 Peter Alaric DeSimone