How to merge 2 WAV files together? Can I take the average of the 2 audio file float values? I'm trying to do one simple thing on Google's C++ Oboe library: pick 2 recordings and merge both. That is, make as if the 2 were playing at the same time.
Oboe works with Float numbers from -1.0 to +1.0. Can I simply do like this:
Audio1:
-0.2, -0.221, -0.23, -0.24, ...

Audio2:
-0.3, -0.23, -0.12, -0.87, ...

Audio Mixed:
(-0.2+-0.3)/2,  (-0.221+-.023)/2, (-0.23 -0.12)/2, (-0.24-0.87)/2, ...

?
That is, take the average of both audios into the new audio?
Is this how 2 simple audio files are merged together?
If your goal is to simply make it sound like they were playing at the same time, you can simply just add them together element-wise. There is need to &quot;average&quot;. The resulting waveform is the same, but scaled by a factor of 2 in your case. Technically, that number could really be anything.
If you want different properties, where maybe one sounds louder than the other, then you'll have to do something else.