Hi
I am writing raw audio bytes from two files into a new wav file to combine the two files. The resultant file which is created has the contents of both the audio clips but there is also a lot of noise in the file.
Can someone point me to a good example which shows how to write raw audio bytes to a file? Here's the basic logic that I am following
SInt32 leftSample1 = ReadSampleFromFile1(music_iter1);
leftSample1 = (SInt32)((float) leftSample1 * 0.7071); //to avoid clipping
SInt32 leftStereoSample2 = ReadLeftSample(music_iter2);
leftStereoSample2 += leftSample1;
if (leftStereoSample2 > 32767)
leftStereoSample2 = 32767;
else if (leftStereoSample2 < -32768
leftStereoSample2 = -32768;
// write leftStereoSample2 to the file
//do the same as left sample to right sample also
++music_iter2;
++music_iter1;
Thanks.