This project has moved. For the latest updates, please go here.

Mixing 2 audio inputs

Nov 15, 2013 at 7:12 PM
I have a need to record the audio coming in from a web cam to the speakers and the audio from a mic together into a mp3 file. (letting the mic listen to the open air speakers is not an option :)

Is NAudio the right tool? (it seems so)

What hardware do I need? (since it seems that a lot of h/w won't let you open both the audio out and mic as recording inputs at the same time)

Thank you for your time,
Dave
Coordinator
Nov 18, 2013 at 11:08 AM
You could possibly achieve this with NAudio, using WasapiLoopbackCapture to get the audio being played by your speakers, and then WaveIn or WasapiCapture to record the microphone. You'd then mix the two recordings together (e.g. using MixingSampleProvider), and then you'd need to pass the results through an MP3 encoder. LAME.exe is one of the easiest ways to do this.

This can all be done on the fly as well if needed, but it is a bit harder, so if you are new to audio programming and NAudio, I'd recommend you start by making two temporary files, mixing into another temporary wave file, and then converting that wave file to MP3.