Code:#include<stdio.h> #include<conio.h> #include<alloc.h> #include<dos.h> #include<string.h> #include<share.h> struct wavdata {unsigned int soundlength, frequency; char *sample; }; struct RIFF { long wave; long fmt; unsigned int BitRes; long data[40]; long datasize[40]; long channels; long samplerate; } header; char fp[25]; char data1[100]; fp =fopen("cwave1.wav", "rb"); if(fp ==NULL) { printf("unable to open to wave file\n"); return(0); } fread( data1,sizeof data1,1,fp); } if(header.RIFF != 0x46464952) { printf("%x\n"); printf(" RIFF format\n"); } if(header.wave == 45564157) { printf("No wavfmt format\n"); } if(header.fmt !=2074666) { printf("No wavfmt format\n"); } //check channels if(header.channels !=1) { printf("Not a mono wave file\n"); return(0); } //check bit resolution if(header.BitRes !=8) { printf("Not an 8-bit wave file\n"); return(0); } // Verify the sample size if(header.samplerate!= 48000) { printf("%x\n"); printf("Sample rate is not 48KHZ\n"); int main() { clrscr(); printf("Play a wave file\n"); printf("Please input filename + extension\n"); gets(fp); return(0); }



LinkBack URL
About LinkBacks



