Project: Algorithmic Soundscapes


Have a c-oneliner generate something you can directly pipe into /dev/dsp or aplay. For an example (this actually started it) check out this YouTube video.

The code usually follows the basic pattern of

main(t){for(t=0;;++t)putchar(  X  );}

Where X is a formula based on t. You can compile it as follows:

# code in code.c
gcc -xc -lm code.c
./code | aplay

If you don't want to compile it yourself, you can use an online service like to render the first few seconds of your track.

You can also compile it inline and have it play directly:

echo "main(t){for(t=0;;++t)putchar(  X  );}"|gcc -xc -lm -&&./a.out|aplay

Note the -lm in both cases which links against the math library so you can use sin, cos, tan, et al.


Formula Who Comment
h0uz3 cool morse blips after a while
hadez slow chippy bassline
h0uz3 Ready for a horror trip? Just add some LSD…
h0uz3 Symmetries are for pussies
h0uz3 Downward spiral
h0uz3 Time to wake up, huh?
h0uz3 23 makes everything a little more sane


samuiraidramatic space aliens
tvBaby-Kübelwagen-Alarm-Therapist #x1 [pre]
tvAlarm-Symphony #x2 (w/happy end)
((t>>7)* 0xff) * (t & 0xff)/32 & ~(t / 127)
bdwheele Almost pac-man
Stereo Version: sso 8-Bit Psytrance? Try at 22050Hz Sampling Rate!
titoBoss level

Tips & Tricks

  • add multiple voices using eg. bitwise or „|
  • use operators and bitmasks! +,-,*,/ and &,^,|,«,»
  • exploit math functions (sin, cos, tan, …)
  • shift left for higher notes „«
  • shift right for lower notes „»
  • add rhythm by shifting everything right by a right-shift of t “(formula)»(t»N)“, the bigger N, the higher the rhythm frequency
  • as with everything algorithmically generated: prime numbers are your friend! they make it sound so much more interesting by yielding less repetitive output
  • build chords!
    • note 1:
    • note 2:
    • combine:
project/algorithmicsoundscapes.txt · Zuletzt geändert: 2013/02/18 14:32 von