Merge/Interleave two WAV files...

Audio software developers forum.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
celoftis
Posts: 2
Joined: Thu Mar 31, 2011 3:08 pm
Operating System: Please select

Merge/Interleave two WAV files...

Post by celoftis » Thu Mar 31, 2011 3:17 pm

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

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Merge/Interleave two WAV files...

Post by Gale Andrews » Thu Mar 31, 2011 7:25 pm

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
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

edgar-rft
Posts: 347
Joined: Sun Jan 20, 2008 12:03 am
Operating System: Please select

Re: Merge/Interleave two WAV files...

Post by edgar-rft » Wed Apr 13, 2011 5:20 am

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.

celoftis
Posts: 2
Joined: Thu Mar 31, 2011 3:08 pm
Operating System: Please select

Re: Merge/Interleave two WAV files...

Post by celoftis » Wed Apr 13, 2011 12:59 pm

edgar-rft wrote: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

Post Reply