0
votes

I'm developing a range finder application where I pulse a sound and then wait for its recording to calculate distance. Naturally this requires very sensitive timing.

Using the NAudio libraries in a windows form application I have been able to get everything to work but there is a delay of about 70ms. What is really the problem is this delay isn't consistent so I can't calibrate it out. I'm looking to either eliminate the delay or make it consistent so I can factor it out. Perhaps running recording and playback in separate threads?

1

1 Answers

1
votes

There are ways to get more accurate timing information from the waveIn/waveOut APIs using waveOutGetPosition for example, which NAudio wraps with the IWavePosition interface.

But for your uses if you can use ASIO instead life will be a lot easier since you have a single callback for both the record and playback buffer at the same time and so there is no danger of drift.