Bytebeat

The video to the right shows off a new genre of music, which since then has been named "bytebeat".

Although the video isn't mine, I've been doing some work over the last few weeks with bytebeat in association with Nonino Alberti Media Lab. At Fábrica de Fallas last weekend, I played a piece (nameless then, now called Crowd, licensed CC-BY) on an Arduino, and it attracted a crowd and some positive attention. Some people asked me for copies as sound files, which I unfortunately didn't have at the time.

The interesting thing is that Crowd, like bytebeat music in general, is a piece of rhythmic and somewhat melodic music with no score, no instruments, and no real oscillators. It's simply a formula that defines a waveform as a function of time, measured here in 1/8000 of a second:

((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7

If you put that formula into a C program with a loop that increments t, it generates the music linked above, as follows:

main(t){for(;;t++)putchar(((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7);}

This generates an endless headerless 8-bit unsigned mono 8ksps file on its standard output. If you compile it as crowd, on Linux you can hear the result by typing ./crowd | aplay, or on older installations ./crowd > /dev/dsp, because aplay and /dev/dsp default to 8-bit unsigned mono 8ksps. I generated the Ogg file linked above as follows:

./crowd | head -c 4M > crowd.raw
sox -r 8000 -c 1 -t u8 crowd.raw crowd.wav
oggenc crowd.wav

I'll be adding more information to this page over time.

Links

Image by Kyle McDonald, licensed cc-by 2.0; part of a set of such visualizations

Bytebeat only dates from September 2011, so there's still a limited amount of information out there about it.

The easiest way to experiment with bytebeat is with the in-web-page bytebeat experimentation tools, one by Bemmu and rarefluid (?) using HTML5 only and one in Flash by @paul_hayes. These both have JS syntax and semantics instead of C, but the differences are minor. There's also a graphing version of Bemmu's tool.

NEWSFLASH: Viznut uploaded a paper to the arχiv. I haven't read it yet. But it outdates the next statement:

So far, the best, and indeed the only, theoretical introduction to bytebeat is a pair of posts on viznut's blog: Some deep analysis of one-line music programs and Algorithmic symphonies from one line of code -- how and why?, which link to three videos he's put together featuring bytebeat music by a number of people: Experimental music from very short C programs, Experimental one-line algorithmic music - the 2nd iteration, and Music from very short programs - the 3rd iteration. (For those interested, he published the code for the visualization algorithm used in the third video.) Viznut also curates a collection of known bytebeat formulas.

I put together a collection of some of these formulas in the form of C programs packaged with a Makefile to play them conveniently; Erlehmann has another similar collection. Diego Alberti of the Nonino Alberti Media Lab and I also got them running on an Arduino that's simultaneously generating composite video; earlier we had gotten them running without video, which was basically trivial. (In both cases audio output is on pin 11 of the Arduino, which we have hooked up via a 470Ω resistor.) I'll get a video posted as soon as I program some visualization effects that aren't completely hideous.

However, the first person to do bytebeat on an AVR or other microcontroller was darkside, who made a radio transmitter out of an AVR, and the Shackspace guys put a bytebeat synth into an RCA plug, called "the Noiseplug", using an AVR.

More recently, Madgarden has written an iPad application, GlitchMachine, that synthesizes bytebeats using Forth-like RPN syntax rather than C-like infix syntax. The app is now available in the App Store. One of his friends made a fantastic blog post about an unfinished version, with an embedded YouTube video of livecoding in GlitchMachine.

One of the most interesting things to come out of GlitchMachine so far has been an URL scheme for bytebeat music, glitch://. Erlehmann has written a free-software second implementation of the URL scheme, in Python, along with an interactive bytebeat editor, called libglitch, and Lymia has written a free-software third implementation of it in Scala. The semantics of the glitch:// virtual machine are a bit different from those of JS or C, but most formulas work fine in any of the three.

There is more discussion about bytebeat at the stuttgart hackerspace Wiki, pouet.net, Reddit (and earlier on Reddit), Hacker News, and the 0xA blog.

Finally, Visy wrote an experimental WebGL visualization of a bytebeat tune.