EDIT:
For anyone finding this post in need of some extra context or a solution. I gave up with trying shortly after I posted this thread. After a year, I decided I would try again. Here is what I found:
the OnAudioFilterRead callback works fine. The delay was because of the way I read the microphone. I didn’t wait for the microphone to reach position 0 in samples. (With Microphone.GetPosition) before reading the data. Resulting in a delay.
For the PCMReaderCallback I could not find a solution. The latency of half a second still exists, even with a small DPSBufferSize or low sample count. It always seems to pre-buffer. This is unfortunate, because this callback works properly with spatializing (with Steam Audio too!) while the OnAudioFilterRead needs some extra effort to make that work.
original post
Hello, I’m trying to implement VOIP in my game using Opus and Mirror. My efforts so far don’t seem to be making any progress in solving the latency issue that I get.
When the audio is received in the client, I play it using the AudioClip.PCMReaderCallback where I just change the data to the latest info, but this seems to have a big latency of about 500ms/1s, which is just way too long.
I’ve also tried using the OnAudioFilterRead method, but the samples there are completely wrong and makes the voice sound very choppy, and like a chipmunk, but then the latency is minimal.
What’s up with this? Does anyone know how to fix the delay issue that I get with the callback?