As a livecoder making music involves me writing a lot of code, this gets tedious really soon and becomes hard to play live or start from a blank state, so lately I have been exploring ways to make music with less code and I ended up finding something that takes this to the extreme and it kinda blew my mind!
Bytebeat: Experimental music from very short C programs
In 2011, a YouTube video showcases seven impossibly short C programs! These programs, some containing as few as three arithmetic operations, could generate audio that actually sounded like music when output as raw sound data.
The beauty of these programs lies in their simplicity. Each one follows a basic pattern: increment a counter variable t infinitely, run it through some mathematical expression, and output the result as audio. That’s it. No synthesizers, no sound libraries, just raw arithmetic outputting 8000 samples per second, producing a waveform with 256 amplitude levels.
What makes bytebeat super interesting is how it discovered novel ways to make music using bitwise operations, which had rarely (if ever) been used for music generation before!
Let us take this simple piece of code
t&t>>8
Its literally 6 characters and is called the Sierpinski harmony. This expression creates what sounds like a multitonal melody with mostly octave intervals. Why? Because the bitwise AND operation splits a simple sawtooth wave into its component square waves, and when these components appear suddenly, our brains interpret them as separate musical notes. The visual pattern of its amplitude values even resembles a Sierpinski triangle, hence the name.
Try running it below and feel free to play around with the different patterns, maybe make your own 👀
Bytebeat
Examples:
- t&t>>8 - Sierpinski
- t*(42&t>>10) - Forty-Two
- t*5&t>>7|t*3&t>>10 - Lullaby
- t*9&t>>4|t*5&t>>7|t*3&t>>10 - Complex
Perhaps the most interesting aspect of Bytebeat is how unscientific it is. Many contributors admitted they had no idea why their expressions worked and they just stumbled upon them and they sounded good. The Forty-Two Melody t*(42&t>>10) was independently discovered by at least three people, generates a musical sequence just by masking bits with the number 42. How cool is that?!
Other discoveries used integer overflow, normally considered a bug to avoid as a deliberate musical effect. Subtracting 1 in the right place could suddenly add percussion. Division by zero, which would crash most programs, created interesting textures in this chaotic space.
Bytebeat happened on the same year i.e 2011 the term algorave was coined by Alex McLean and Nick Collins during a car ride on the M1 motorway in the UK while heading to a gig! This spawned tools that let anyone experiment in real time, adjusting expressions and immediately hearing the results. It influenced artistic communities like demoscene, glitch art, live coding, and led to new software projects exploring even more constrained programming environments.
Try it yourself and see where the rabbit hole takes you :)
Leave a Comment