I am taking a .wav file (input) and changing its volume by (value) and then outputing that into a new .wav file (output). The first 44 bytes of a .wav are the header and I am reading then writing to the new .wav file.
uint8_t header[HEADER_SIZE];
fread(header, sizeof(uint8_t), HEADER_SIZE, input);
fwrite(header, sizeof(uint8_t), HEADER_SIZE, output);
Then I am reading input, multiplying by (value), then writing to output.
int16_t buffer;
while (fread(&buffer, sizeof(int16_t), 1, input ))
{
buffer = buffer * factor;
fwrite(&buffer, sizeof(int16_t), 1, output);
}
Initially I tried to pass through (input + 44) and (output + 44) thinking I would point to the start out the file then go 44 more bytes. This didnt work so when I finally looked at the solution I changed my code to the above.
My question is how does this not (try to) multiply the header files by value? Or How does the program know to start multiplying after the header?