Merge/Interleave two WAV files...

BACKGROUND
I have a program that is generating two WAV files. Each WAV file represents one (1) side of a two-person conversation. I want to combine the two WAV files into one file for playback such that the two sides of the converations are interleaved (vs appending one WAV file to the other). I will be using VB.NET to program this task.

QUESTION(s)
I know that I can open each WAV file parse out the information in the headers and merge/interleave the samples but I was hoping there was a (free) software package / API out there that can accomplish the same thing… does Audacity have an API that I can call the perform this interleaving operation? If not, do you have any suggestions on how to approach this task?

Thanks for your attention to my question,
celoftis

Obviously Audacity can mix audio files together, but you should be aware that it is under the General Public License (GPL). So if you want to use Audacity in your application then you either have to make your entire program GPL (distribute its source code so that others can use it), or distribute the code that uses Audacity as a separate component with its own licensing agreement. Also be aware that Audacity is written in C++. You could take a look at /src/Mix.cpp in the code.

If you want a definitive answer beyond that, it would probably be best to subscribe to the developers’ mailing list and ask there directly. Please be aware we are very busy preparing a release at the moment.




Gale

celoftis: > … do you have any suggestions on how to approach this task?

See http://sox.sourceforge.net/, i.e. libsox, also the sox “-m” option and the “mixer” effect.

Great that is exactly the approach I ended up taking. Here are the options that I used:
sox.exe --multi-threaded --combine mix file1.wav file2.wav combined.wav --norm gain -e