A friend just showed me this cool way to generate a full song using 1 line of C code.
main(t){for(;;t++){putchar((t*(t&t>>12)*8/11025)|0,((t&16)/8-1)*(t*(t^15)+t+127));}}
Dump this in a main.c, and compile it
echo "main(t){for(;;t++){putchar((t*(t&t>>12)*8/11025)|0,((t&16)/8-1)*(t*(t^15)+t+127));}}" > main.c
gcc main.c -o song
One way to play it is to pipe it to aplay (needs ALSA)
./song | aplay -r 44100
Another way is to dump it into file.raw and use ffplay (needs FFMPEG)
./song > file.raw
ffplay -f u8 -acodec pcm_u8 -ar 44100 file.raw
Remember to use Ctrl-C to stop it since it loops infintely.
Enjoy!