Hello, I am trying to create a WAV file from another WAV file. I have written 3 functions: _readWavFileIntoAudioSampleBuffer reads a WAV file into an audio sample buffer, _writeToWavFile writes WAV samples to a file, and _writeToOutputBuffer copies WAV audio samples from one audio buffer to another.
If I read a WAV file into a buffer and then write it to another file, the resulting file is the same as the original, so the problem may not be with how I read and write WAV data.
The other function, the one that copies WAV samples between buffers contains this:
outputAudioBuffer.addFrom(
0,
0,
sourceAudioBuffer,
0,
0,
sourceAudioBuffer.getNumSamples(),
1.00
);
The output buffer is 4 seconds long and is created like this:
//
double dblSamplingRate = 48000;
double dblDurationTicks = 4000; // 4 seconds
int iSampleLength = (int)(dblSamplingRate * dblDurationTicks / 1000.0);
juce::AudioSampleBuffer outputAudioBuffer(1, iSampleLength);
After reading a WAV file, copying the samples to the output audio buffer, and saving to disk, the resulting WAV file is silent. No sound from the source file is present.