-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: audio3d
action: blob
revision:
path_from: wave.c
revision_from: refs/heads/master:
path_to:
revision_to:

git.thebackupbox.net

audio3d

git://git.thebackupbox.net/audio3d

blob of:

audio3d

/ wave.c

refs/heads/master:/wave.c
 #include <stdio.h>
 #include <math.h>
 #include <unistd.h>

 int main(int argc,char *argv[]) {
   double d,d2;
   int i,j;
   unsigned char s;
   unsigned char p;
   int length=5;//5 seconds
   int freq = atoi(argv[1]);
   int bits=8;//8bit audio
   //int rate=8000;//8khz samples per second
   int rate=44100;
   int k=0;
   while(1) {
   for(i=0;i<length;i++) {
     for(j=0;j<rate;j++) {
       //read(0,&s,1);
       d2=cos((float)k * (float)freq * M_PI * 2.0 / (float)rate) * 127.0 + 128.0; //8bit panning
       p=(unsigned char)d2;
       //write(1,&s,1);//"left" channel is actual audio
       //"right" channel is left-right pan
       write(1,&p,1);//all right.
       //write(1,"\0",1);//empty byte.
       //if the freq is 1 hz, it start at 0, go to 1, go to 0, go to -1, and back to 0
       k++;
     }
   }
   }
 }

-- Response ended

-- Page fetched on Sun Jun 2 16:56:47 2024