ByteBeat: Music with one line of code

Posted by StuffonmyMind on December 11, 2025

Livecoding music involves writing a lot of code, this gets tedious real soon and becomes a challenge 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

Bytebeat

Examples:

Bytebeat is esoteric and weird, Many contributors admitted they had no idea why their expressions worked and they just stumbled upon them. The Forty-Two Melody t*(42&t>>10) was independently discovered by at least three people, itgenerates 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.

I found this really cool Bytebeats Beginner’s Guide to get started with this tool. It explains what the mathematical and bitwise operators do, slowly building up to a step sequencer! It’s also too much to just fuck around with the examples and make cool beats.




Comments

Leave a Comment