added make_raw tool, to create raw sound files
authorhackbard <hackbard>
Fri, 24 Sep 2004 11:09:56 +0000 (11:09 +0000)
committerhackbard <hackbard>
Fri, 24 Sep 2004 11:09:56 +0000 (11:09 +0000)
.cvsignore
Makefile
make_raw.c [new file with mode: 0644]

index 8b5892c..0c27c42 100644 (file)
@@ -1,3 +1,4 @@
 hdrec
 *.wav
 *.raw
+make_raw
index a27d210..1d9af21 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,9 @@ all: $(TARGETS)
 hdrec:
        $(CC) $(CFLAGS) -Wall fourier.c oss_api.c hdrec.c -o hdrec -lm -ldirectfb
 
+make_raw:
+       $(CC) -O3 -Wall make_raw.c -o make_raw -lm
+
 clean:
        rm $(OBJS) hdrec
 
diff --git a/make_raw.c b/make_raw.c
new file mode 100644 (file)
index 0000000..6d34f99
--- /dev/null
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <math.h>
+#include <unistd.h>
+
+/* produce an a + 1st and 3rd "oberschwingung" as a raw file for 44100 sr */
+
+int main() {
+
+       int i;
+       short m;
+
+       for(i=0;i<100000;i++) {
+               m=0.2*0x7fff*sin(2.0*M_PI*((double)i*440/44100));
+               m+=0.4*0x7fff*sin(4.0*M_PI*((double)i*440/44100));
+               m+=0.3*0x7fff*sin(8.0*M_PI*((double)i*440/44100));
+               write(1,&m,2);
+               write(1,&m,2);
+       }
+
+       return 1;
+}
+