# Creating a WAV file from other WAV files, addFrom(...)

**URL:** <https://forum.juce.com/t/creating-a-wav-file-from-other-wav-files-addfrom/48695>\
**Category:** General JUCE discussion\
**Created:** [November 9, 2021, 5:34pm UTC](https://forum.juce.com/t/creating-a-wav-file-from-other-wav-files-addfrom/48695 "2021-11-09T17:34:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HenryBenbowLtd](https://avatars.discourse-cdn.com/v4/letter/h/eb8c5e/32.png) [@HenryBenbowLtd](https://forum.juce.com/u/HenryBenbowLtd)\
**Post date:** [November 9, 2021, 5:34pm UTC](https://forum.juce.com/t/creating-a-wav-file-from-other-wav-files-addfrom/48695/1 "2021-11-09T17:34:49Z")

</div>

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.
