Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ AUDIO THREAD PART III

Name: Anonymous 2008-05-24 3:21

#include <stdio.h>
#include <stdlib.h>

main() {
 int i,j,k,l;
 while(1) {
  l=rand()%100;
  for(k=0;k<l;k++) {
   for(i=0;i<255;i+=128)
    for(j=0;j<k;j++)
     putchar(i);
   for(;i;i-=128)
    for(j=0;j<k;j++)
     putchar(i);
  }
 }
}


gcc -o lolsound lolsound.c
./lolsound > /dev/dsp


First one to hack this into saying "Have you read your SICP today?" gets an internet.

Name: Anonymous 2008-05-25 23:23

>>30
You mean that adding up both lineally would work? Taking two parts of the wave from the od output above:


0000000 127 161 193 220 239 251 253
...
0000016  45  22   6   0   3  15  35


I make them signed, and then add up:

0000000   0  34  66  93 112 124 126
0000016 -82-105-121-127-124-112 -92
        ----------------------------
        -82 -71 -55 -34 -12  12  34


Which makes me really think there's something wrong. I'm not sure. Maybe I can't believe that it would be that easy.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List