A better way would be to use a BufferedWaveProvider as input to WaveOut. Then, in the DataAvailable WaveIn callback, feed the data written to the BufferedWaveProvider
void DataAvailable(object sender, WaveInEventArgs args) { bufferedWaveProvider.AddSamples(args.Buffer, 0, args.BytesRecorded); }
You need to know that the default buffer size will lead to a noticeable delay, so if you were hoping for a low latency, you might need to experiment a bit with the buffer sizes to see how much you can get it.
source share