Skip to content

andreasjansson/synth-one-liner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Synth one-liner

Run on Replicate

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,

main(t){for(t=0;;t++)putchar(t*(((t>>12)|(t>>8))&(63&(t>>4))));}

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.

It works surprisingly well, try it out here: https://replicate.com/andreasjansson/synth-one-liner

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages