I'm writing a program (c++, vs2010,win7) that records audio into a wav file. When I try to hear the audio it has a lot of white noise. I tried to reopen the file with another program that I wrote. The only thing this program does is :
Char buffer[8000*60*2] = {}
File *wav, *out
Wav = fopen ("raw", "r+")
Out = fopen("out", "a+")
fread(buffer, sizeof (char) *8000*60*2,1,wav)
fwrite(buffer, sizeof (char) *8000*60*2,1,out)
fclose (wav)
fclose (out)
After I pass the raw data through this program I can hear a small part of the original wav file without any noise(i open this in audacity as raw data). My problem is that I'm not changing anything in the data just writing it again and like a magic I can hear clearly. What am I missing? I don't make any change of the data. When I write the data I write it as a short var. data is short fwrite(data, 1024,1,wav)