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:09

>>28
Well, what happens if you were to set up two speakers in the same room playing two different tones? The instantaneous pressure from the two would be added together. If you want to mix two sound waves, you just need to add their amplitudes for that sample together.

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