0
0

Hello,

I’m using FMOD Ex in a program written in C++ and compiled using MinGW; the program itself is running on Windows 7. The aim of the program (or one part of it, at least) it to briefly present a flash and a burst of white noise at the same time. I expected that some latency would need to be accounted for, but the program exhibits a rather large (for our purposes) audio latency of 65-75 milliseconds (it was originally on the order of 75-95 ms, but we replaced the onboard audio device with a [url=http://us.creative.com/p/sound-blaster/sound-blaster-audigy-fx:1xb1vwj9]sound card[/url:1xb1vwj9], which reduced the latency to some extent).

Here’s a screenshot from an oscilloscope showing the delay:
[attachment=0:1xb1vwj9]Oscilloscope screenshot illustrating audio lag.png[/attachment:1xb1vwj9]
The orange trace is the white noise; the teal trace is the flash (for the record, the amplitude decreases – rather than increases – on the teal trace because its probe was set to invert mode at the time).

The program is structured as follows: the white noise sound is loaded when the program starts, and during the actual operation of the program the commands to play the sound occur immediately before the command that displays the stimulus (so, in a perfect world, the two would be close to simultaneous).

The sound is loaded as follows:
[code:1xb1vwj9]
fmodResult = FMOD_System_CreateSound(fmodSystem, pathString.c_str(), FMOD_SOFTWARE | FMOD_2D, 0, &fmodSound1);
[/code:1xb1vwj9]
(I’m using the C interface because FMOD Ex’s C++ interface doesn’t support MinGW. I’ve also left out the error-checking code in these listings to save space.)

Here are the commands that play the sound (I’m doing some non-standard audio panning, hence the extra stuff):
[code:1xb1vwj9]
// leftLevel and rightLevel are floats between 0 and 1 that specifies the gains for the left and right speakers
fmodResult = FMOD_System_PlaySound(fmodSystem, FMOD_CHANNEL_REUSE, fmodSound1, false, &fmodChannel1);
fmodResult = FMOD_System_LockDSP(fmodSystem);
fmodResult = FMOD_Channel_SetSpeakerMix(fmodChannel1, leftLevel, rightLevel, 0, 0, 0, 0, 0, 0);
fmodResult = FMOD_Channel_SetPaused(fmodChannel1, false);
fmodResult = FMOD_System_UnlockDSP(fmodSystem);
[/code:1xb1vwj9]
I’ve tried both the FMOD_SOFTWARE and FMOD_HARDWARE modes, as I’ve read elsewhere on the forum that this can influence latency; unfortunately, there is no detectable difference in the average latency between the two in my case.

Based on these results, I was wondering if there’s anything besides the SOFTWARE/HARDWARE mode switch that I can try in software to reduce the latency. Also, is it possible that switching to a more powerful computer would improve the latency? The program is running on a desktop system, but it’s getting on in years (it’s equipped with an [url=http://ark.intel.com/products/29765/Intel-Core2-Quad-Processor-Q6600-8M-Cache-2_40-GHz-1066-MHz-FSB:1xb1vwj9]Intel Q6600[/url:1xb1vwj9], which is a good processor but one that is admittedly a bit old now).

Any suggestions would be appreciated; if there’s any additional information I can provide that would help to narrow the issue down, please let me know.

  • You must to post comments
0
0

I tried using the [url=http://www.asio4all.com/:1dqllndu]ASIO4ALL[/url:1dqllndu] drivers (with FMOD’s output mode set to FMOD_OUTPUTTYPE_ASIO using System::setOutput) and they appear to have resolved the problem.

  • You must to post comments
0
0

The major contributor to latency in FMOD is the DSP buffering, you can control this with System::setDSPBufferSize, the default is 4 buffers of 1024 samples.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.