The Corruption Loops

Digitally disintegrating music

Alex Bainter
8 min readJun 28, 2019

I just published a website called Corruption Loops, which you can visit at corruptionloops.alexbainter.com. This site generates a unique, short piece of music and plays it repeatedly. As it plays, the audio data is slowly corrupted, and you can listen to the music transform into noise. Here’s how it works.

Inspiration

Corruption Loops is inspired by The Disintegration Loops, a series of albums from composer William Basinski. These albums were created by recording short loops of music on old magnetic tape played over and over. The tape loops were so old they physically deteriorated as they played, and this process was recorded by Basinski. Listening to the albums, you can hear the tapes pop and stutter, which gets progressively more noticeable as you listen.

Corruption Loops is an attempt to recreate this experience with digital audio.

The Digital Representation of Sound

Have you ever wondered how Lil Nas X’s “Old Town Road” is stored in our computers? How are sounds represented with just ones and zeroes?

You’ve probably heard that sound travels through waves. Waves measure vibration or oscillation. Imagine the rapid up and down movement of a twerking booty. If you graphed the height of the booty over time, you’d end up with this visual representation of a wave:

Similarly, sound travels to your ear by rapidly compressing and decompressing the air between the sound’s source and your eardrum. If you graphed the amount of compression of the air between the source and your ear over time, you’d have a graph that looks just like the twerk wave above.

To represent waves digitally, we need a numerical description. To obtain this, we can record the value of whatever we’re measuring (be it air compression or booty height) at a regular interval. Say we play a sound while measuring the air pressure every second and observe the following measurements:

The combination of our observed values and the time interval we recorded them with is a numerical representation of the sound wave. To increase the accuracy, we could decrease the time between measurements and thus measure the wave more often. In digital audio lingo, the rate at which you measure the sound wave is called the sample rate. CDs (remember those?) store audio at a sample rate of 44,100 samples (or measurements) per second.

But digital audio data doesn’t store the absolute pressure values as described here. Instead, absolute measurements are converted to a value relative to the maximum deviation from the resting state. In the example above, the resting state of the air pressure is 15 psi and is indicated by the dotted black line. Since the highest and lowest values we observed are 17 psi and 13 psi, the maximum deviation observed is 2 psi (17–15=2, 15–13=2). Let’s draw another graph, but convert our observed values to a ratio of the observed deviation to the maximum deviation:

We could multiply all these relative values by the same number, and the resulting wave will have the same shape as the original. For example, here’s a graph with every value divided by 2:

This wave has the same shape but a smaller amplitude, which is the distance from the wave’s resting point to its current value. As the amplitude of a sound wave increases, so does the loudness. In digital audio, an amplitude of 1 indicates the maximum loudness the device is capable of. When you crank up the volume on your device so you can jam out, you’re increasing the absolute loudness that the relative amplitude of 1 translates to.

It’s common practice among sound designers to leave some “headroom” between the sound wave’s highest amplitude and the device’s maximum loudness to prevent audio distortion during playback. You’ll notice this in the sound wave for “Old Town Road” I’m about to show you. For sound designers, it’s not recommended to turn up the volume ’til you can’t no more.

This relative value format is how digital audio data is actually stored. Of course, the sound wave of “Old Town Road” will be more complicated than the ones I’ve been showing you. Let’s take a look:

You’re probably thinking this doesn’t look anything like the waves I’ve been showing. What gives? I’ll zoom in:

Now that’s a wave. If you look at the times above the graph, you’ll notice this is only showing about 4 milliseconds of sound, which gives an idea of just how complicated this sound wave is and why we use high sample rates.

This recording consists of 7,450,819 separate values. Here’s a small subset from the middle of the audio data:

0.03340842202305794
0.030771296471357346
0.026208367198705673
0.021720338612794876
0.018609169870615005
0.012957542203366756
0.0015644095838069916
-0.010522458702325821
-0.016514630988240242
-0.018401024863123894
-0.022093987092375755
-0.026828601956367493
-0.02875547669827938
-0.028812792152166367

As much as you might enjoy a digital destruction of “Old Town Road,” for Corruption Loops I decided to generate my own music to corrupt instead. And can’t nobody tell me nothin’.

Music Generation

Corruption Loops uses a very simple process for generating a unique recording of music every time it’s played. Each recording will contain seven piano notes, C3, E3, G3, C4, E4, G4, and C5. For each note, a random time between 0 and 5 seconds is chosen for the note to play at. This is recorded for 10 seconds to create the music that’s looped.

On the site, I claim the recording you hear “will never be generated again.” In truth, it is possible for the site to generate the same recording multiple times, but it’s extremely unlikely. Let’s examine just how unlikely.

To select the play time for each note, I use the JavaScript function Math.random() to get a random number between 0 (inclusive) and 1 (exclusive). I multiply this value by 5 which gives me a random a number between 0 and 5. This value dictates the time of the recording at which the note will play.

The numbers returned by Math.random() can be decimals with about 16 digits of precision. It can return 0, or 0.0000000000000001, or 0.0000000000000002, all the way up to 0.9999999999999999, meaning there are 10,000,000,000,000,000 (10 quadrillion) numbers it could return. In other words, each note has 10 quadrillion possible start times. Since there’s seven notes, there are 10,000,000,000,000,000⁷ possible recordings. That’s a 1 followed by 112 zeros, or 10¹¹². Compare this to the estimated number of atoms in the observable universe, which is 10⁸⁰.

So… I’m pretty comfortable stating the site will never generate the same recording again. If you’d like to prove me wrong, feel free to refresh the site over and over until you get the same recording, and let me know when you do. If you can get all 7.7 billion people on Earth to join your cause and refresh the site once per second, it will only take about 4.12 x 10⁹⁴ years (that’s 412 followed by 92 zeros) for the entire human race to get through all the possible recordings. Good luck!

Data Corruption

I showed an example of audio data above and explained how it can be represented as a series of numbers. What would happen if we rearranged those numbers and played back the result? What if we overwrite them with random numbers? What would it sound like?

This is precisely what Corruption Loops does to the recordings it generates. Each time it loops, the site iterates through all the numbers and randomly makes changes. Sometimes it will take a chunk of numbers and copy them to another location, or swap them with the numbers at that location. It can also take a chunk and reverse them, causing the audio at that section to play backwards. Other times it will simply overwrite values with random numbers. The decisions made while corrupting the data is controlled by random numbers, so it will never corrupt any two recordings in exactly the same way (surely I don’t need to repeat the previous exercise). Since many of the numbers are overwritten with random values every loop, the music will slowly transform into noise. If you listen for long enough, the site will become a white noise generator.

Unlike with Basinski’s Disintegration Loops, I’m able to control the destruction process in Corruption Loops. This is kind of cheating since I’m able to change the rules to achieve whatever aesthetic I want, a luxury not afforded to Basinski.

Originally, I had a single music loop which was used every time. I wasn’t happy with this because the corruption process becomes meaningless when you know there’s a copy of the data safe and sound. What I like about The Disintegration Loops is the listener knows those tapes are permanently damaged and will never again sound the way they did at the beginning of the albums. I wanted Corruption Loops to convey a similar feeling that something unique was being lost forever, which is why the recording generation is crucial to the experience.

We live in a time when recordings are ubiquitous and allow us to experience the same thing as many times as we’d like. It wasn’t that long ago when recording technology wasn’t available and “music” meant something happening live, once, and never again. Today, it’s rare to only get to hear something once, especially with the ease of making and consuming digital copies. But now, software enables us to create new art with both the convenience of a recording and the joy of a unique experience.

Thanks for reading. I hope you have a great day.

I build endless ambient music generators at Generative.fm. The music made by these generators continuously changes and never repeats, so they’ll never play exactly the same way twice. You might like it if you enjoy ambient music or you need something to listen to while you focus.

For paywall-free links to my Medium posts, you can follow me on Twitter or subscribe to my infrequent newsletter.

--

--

Alex Bainter

A web developer creating audio/visual experiences both digital and not. Currently making generative music at Generative.fm.