andreasjansson / synth-one-liner

Generate "algorithmic symphony" one-liners with grammar-constrained CodeLlama

Demo API Examples Versions (3b1b5e4f)

Run time and cost

Predictions run on Nvidia A40 (Large) GPU hardware.

Synth one-liner

In 2011 Viznut posted a blog post called “Algorithmic symphonies from one line of code – how and why?”. He described a way to generate algorithmic 8-bit synth compositions in a single line of C. For example,


You’d compile that program and pipe it to your soundcard, and it would play an ever-evolving piece of noise music.

This is so fucking cool. That little equation t*(((t>>12)|(t>>8))&(63&(t>>4))) will tweak the bits of the value of the current time step as a kind of chaos process that actually sounds great!

I wanted to see if I could do that automatically.

Automatic one-liners

Using CodeLlama 7B I make a prompt with a bunch of one-liners from IRC.

I then use Llama.cpp’s grammar decoder to constrain the output to valid one-liners. Those one-liners are then evaluated and converted to audio.

Cover image by