mix input and output

Jan 12, 2013 at 2:08 PM
Edited Jan 12, 2013 at 2:10 PM

Hello,

I have just started out playing around with the NAudio library,

as my soundcard does not support a "what you hear" record feature I need to have NAudio mixing a WaveIn signal with another WaveStream played in the background.

I've so far accomplished to record the input signal with a WaveIn object, and also using the WasapilLoopbackCapture to record any sound playing of the output instead.

So it's either the one or the other that gets recorded.

 

I've looked for a way to mix these two signals using the WaveMixerStream32 but I'm not sure if this is possible and how I should implement this to work

(The WaveMixerStream32 takes no WaveIn but only Stream objects)

 

Any help on this subject is appreciated!

 

Regards Niclas

Coordinator
Jan 15, 2013 at 2:26 PM

WaveMixerStream32 is an older class that has some fairly specific requirements for its inputs. One option is to use two BufferedWaveProviders, each filled with the data receieved. Then convert those IWaveProviders into ISampleProviders and mix them with the MixingSampleProvider (mixing works best at 32 bit float which is why you need this extra step).