Audio Latency on recording

Hi,
I’m testing recording audio alongside some other audio playing in the background (like a music mixer).
When I play the recorded track back alongside the backing tracks it’s delayed by around 200 ms or so.
(I’m pretty certain I’m playing in time with the backing).

By saving the recorded audio to wav I can compare in Audacity against the backing to determine the lag.

Any tips/ideas/suggestions on what could be causing this or workarounds or ideas to try?

ty!

You should be able to reduce that considerably either by waiting for the Microphone.GetPosition() to get close to the AudioSource.timeSamples right after Microphone.Start() has been called, or by having the script adaptively and very slightly increasing/decreasing the playback speed depending on the difference between the two.

Hi Janm,
Thanks for the ideas.
I’m already doing #1:
//Start recording and store the audio captured from the microphone at the AudioClip in the AudioSource
goAudioSource.clip = Microphone.Start (null, false, length, maxFreq);
while (!(Microphone.GetPosition(null) > 0)) {
}
By “get close to the AudioSource.timeSamples right after Microphone.Start()” do you mean while (!(Microphone.GetPosition(null) >[the backing track].AudioSource.timeSamples ? What timeSamples if so?

For #2 I’ve been experimenting with delaying the captured mic clip on playback by delaying it a small amount, but it’s tricky. My other concern with this method is it may vary considerably depending on the platform which makes it a little dodgy for production. Unless this is a consistent engine/fmod delay I can factor in?

ty