I was wondering is there any way to record sound of a certain application? I've searched for a while but didn't found some useful information about this. So now I'm using NAudio library to record WASAPI loopback and microphone sound, mix them together and save to mp3 file using this code:
Silence = new WaveOut();
Silence.Init(new SignalGenerator() { Gain = 0 });
Silence.Play();
SoundOut = new WasapiLoopbackCapture();
SoundOut.DataAvailable += SoundOut_DataAvailable;
SoundOut.StartRecording();
SoundOutBuffer = new BufferedWaveProvider(SoundOut.WaveFormat);
SoundIn = new WaveIn();
SoundIn.WaveFormat = SoundOut.WaveFormat;
SoundIn.DataAvailable += SoundIn_DataAvailable;
SoundIn.StartRecording();
SoundInBuffer = new BufferedWaveProvider(SoundIn.WaveFormat);
List<ISampleProvider> Sources = new List<ISampleProvider>
{
SoundOutBuffer.ToSampleProvider(),
SoundInBuffer.ToSampleProvider()
};
Mixer = new MixingSampleProvider(Sources);
Sampler = new SampleToWaveProvider16(Mixer);
MP3Writer = new LameMP3FileWriter("File.mp3", Mixer.WaveFormat, 128);
Also I found CSCore library which seems to look like NAudio with some extra features, but a complete lack of documentation. May be CSCore have functionality which I need?