// wav_to_dat.c read a .wav write a .dat just the amplitude // wav_to_dat file.wav file.dat // compile with rw_wav.c #include #include #include #include "rw_wav.h" int main(int argc, char * argv[]) { int i; char input_name[60] = "cat.wav"; char output_name[60] = "cat.dat"; header w; char sound[1000000]; FILE * outp; int count; printf("wav_to_dat.c running \n"); if(argc<2) { printf("no input file given, using %s \n", input_name); } else { strcpy(input_name, argv[1]); printf("try to open %s for reading. \n", input_name); } if(argc<3) { printf("no output file given, using %s \n", output_name); } else { strcpy(output_name, argv[2]); printf("try to open %s for writing. \n", output_name); } printf("calling read_wave from %s \n", input_name); read_wave(input_name, & w, sound); printf("writing float data to %s \n", output_name); outp = fopen(output_name, "w"); if(outp==0) { printf("can not open %s \n", output_name); exit(-1); } printf("header.csize=%d \n", w.csize); count = w.csize-1; for(i=0; i