tl;dr I want to put data from asio_DataAvailable(object sender, AsioAudioAvailableEventArgs e)
event into a BufferedWaveProvider
and play them back.
Hello,
I am trying to make an app, which will record audio to a file, but also play it back to the user while recording. I managed to do it using WaveInEvent and WaveOutEvent and a BufferedWaveProvider. But I thought that ASIO would have a better latency, so I wanted to do the same thing using it.
I found questions here on this topic, but none of them contained a complete answer and I couldn't work it out based on them. Could you please post a complete working example of the code?
NAudio Asio Record and Playback
How to record and playback with NAudio using AsioOut
I tried the version with Marshal.Copy, but got IndexOutOfRangeException. The buffers (e.InputBuffers[i]
) seems to not have enough samples. I also want to work with the audio further (save it to a file) and at the same time play another audio (using MixingSampleProvider), so just simple copying the buffers probably doesn't work for me.