Regarding Offset when using OpenAL on Windows (Lag of 100 ms)

Started by AJ, February 24, 2010, 20:49:19

Previous topic - Next topic

AJ

Hello,
When I use OpenAL in windows it gives me an offset of about 100 ms (that is it plays the frames which are 100 ms before the current frame). And it works perfectly fine on MAC that is it plays the exact frame it is given or asked to play.

In order to demonstrate this behavior I have written a small test case which can be downloaded from the below provided link.

http://memory.psych.upenn.edu/files/software/TotalRecall/OpenAlDemo.zip


Please read the readme file for the instructions on running it.
In Main.java I basically ask openAl to play frames in a range of 200ms and the start of the range is such that a beep starts at that point. Try running this program on Mac and Windows. On windows you would not be able to hear anything, whereas on Mac you can hear a Beep.

I have cross verified that it plays right frames on Mac and on windows there is a delay or offset of about 100 ms consistently using a waveform.

Can someone please tell me how to resolve this issue.
Is it a upstream fault or am I missing out on something here.

Thanks

princec

Which version of Windows? The sound engine under Windows Vista/7 is entirely software based and completely different to the hardware/software based stuff in XP. I imagine it has a pretty noticeable effect on latency.

Cas :)

carneades

Hi Cas,

I'm working on the same project as AJ.
I can replicate the problem on both Windows XP and Windows 7. I have not tried Vista but I'd bet it's the same.

Also, I don't think this is an issue of latency. We're not saying that the audio comes too late. We're saying it comes not at all! We have a program that displays the waveform of an audio file and allows you to play little snippets of it. We noticed that on Windows the audio and video are off by a constant offset. The problem does not affect Mac.
We wrote the minimal compileable example linked to above to show that the problem is not with our waveform code. If you run it you should hear a beep on Mac but will hear nothing in Windows.

It's an odd problem. As I understand it LWJGL uses different OpenAL implementations for Windows and Mac right? Maybe the issue is upstream with OpenAL Soft or with LWJGL's bindings to it. Or maybe we're overlooking something!

Thanks for your help, suggestions welcome.

princec

Do you think it might be a built-in compensation for some latency issue?

Cas :)

carneades

Hi Cas,

It's hard to speculate as to whether it's some kind of runtime correction since I don't know how the OpenAL implementation (Soft?) works.
But I think it's unlikely since the problem can be reproduced on all three Windows machines I have access to. Also, the system does play back the correct amount of audio, just with an offset.
Any chance you have run the example?

princec

I got around to looking at the source but at work so couldn't tinker with it straight away. I first want to eliminate AudioInputStream from the equation and use raw PCM in a ByteBuffer to see if that exhibits the problem.

Cas :)

carneades

Ok thank you Cas. I don't think that's the problem since we've used AudioInputStreams with a different audio backend (Java Sound) without any portability issues. But I guess it is good debugging habit to eliminate middlemen.
I'll try to convince my boss to donate to the project next time I see him. Audio has been our biggest (and only) barrier to a fully open-source cross-platform program.