Change WAV File In C -


i'm trying change wav file factor c. need multiple bytes factor i'm getting user. wrote function read 2 bytes , return short int type. can output file out file example program have. please ** attaching code

void modify_data(unsigned char*buffer, char *name, long filelen, float factor){ short  temp=0; char byte[2]={0}; file *fp=null; int i,big=0; unsigned int check=0; char *str=strtok(name,".");  sprintf(name,"%s‫‪_modified‬‬.wav",name); fp=fopen(name,"wb"); fwrite(buffer,1,44,fp); (i=44;i<filelen;i+=2){     check=0;     temp= (short)read_short(i,buffer);      printf("%hu\n",temp);     /*check=(int)(temp | check);     check=check*factor;     printf("%d\n",check);      //getchar(); */     if ((roundf(temp*factor))>= max16bit){      temp=max16bit;     printf("true\n");     }      else {           if  ((roundf(temp*factor)) <= -1*max16bit) temp=-1*max16bit;         else temp=(short)round((double)(temp*factor));     }     byte[0] = (temp & 0xff);         byte[1] = ((temp & 0xff00)>>8);     fwrite(byte,1,2,fp);     temp=0;     } fclose(fp); } 


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -