4 ms·
You can generate music with algorithms too. I came across this a while ago: echo "main(i){for(i=0;;i++)putchar(((i*(i>>8|i>>9)&46&i>>8))^(i&i>>13|i>>6));}"
by dave1010uk 14y ago
You can generate music with algorithms too. I came across this a while ago:
echo "main(i){for(i=0;;i++)putchar(((i*(i>>8|i>>9)&46&i>>8))^(i&i>>13|i>>6));}" | gcc -x c - && ./a.out | aplay
The generated a.out is 8.5kB for me though.
- leephillips 14y agoThat sounds better than most of the pop music out there. Amusing demonstration of ... something!
- zxcdw 14y agoDemonstration of using very few bytes of data to generate art. The same snippet of code can (very probably) be written as a < 128 byte ELF binary on Linux.
- algorias 14y agoOf course, it gets linked in the standard way. A program with an empty main takes up about the same space. The point is that this snippet could be compiled very compactly with the right tools.
- tehwalrus 14y agodude, that is awesome! (although, I will now spend a good few hours working out how on earth you get the 16 bar repeats, with variations, and indeed the kick, from some crazy bitshift magic.)