title: How to change the volume of a .wav file?
body: <p>My code is just copying the header but doesn't change the volume at the second loop.</p>
  <pre><code>// TODO: Copy header from the input file to the output file
  
  uint8_t header[HEADER_SIZE];
  uint8_t* header_p=malloc(HEADER_SIZE * sizeof(uint8_t));
  while(fread(&amp;header_p,sizeof(header[HEADER_SIZE]),1,input))
  {
      fwrite(&amp;header_p,sizeof(header[HEADER_SIZE]),1,output);
  }
  
  // TODO: Read samples from the input file and write updated data to the output file
  
  int16_t buffer;
  
  while(fread(&amp;buffer,sizeof(buffer),1,input))
  {
      buffer =(int16_t)(buffer*factor);
      fwrite(&amp;buffer,sizeof(buffer),1,output);
  }
  </code></pre>