Welcome! Log In Create A New Profile

Advanced

Delayed sound onset

Posted by momoyuki 
Delayed sound onset
August 02, 2022 03:31PM
Hello,

I'm planning to play a sound using the "AudioSound" adapter. When I recorded the event code that indicates the beginning of the sound and the actual sound outputs from the computer in our recording system, the actual sound outputs had about 30-45 msec of delays from the event codes (this delay peaked around 40-42.5 msec).
One frame of delay should be reasonable with Timing Script v2, but I'm not sure what causes other frames of delay.

I don't need to precisely control the timing to start playing the sound but need to collect the precise time stamps for the initiation of sound. Is there any way to synchronize the event code and the sound signal output (for example, delay the timing to send the event code)?

Thank you!


%% script used to test the AudioSound output
snd = AudioSound(null_);
snd.List = 'tone_2a.mat';
scene = create_scene(snd);

pause(3);
run_scene(scene,2);
eventmarker(4);
pause(1);
Re: Delayed sound onset
August 02, 2022 04:23PM
The audio latency you are talking about has nothing to do with NIMH ML. It is the internal audio processing time of Windows.

My paper about the audio latency is in review. I cannot show the exact numbers yet, but the latency you saw can be reduced significantly if your sound card supports the WASAPI Exclusive mode. See this manual page. https://monkeylogic.nimh.nih.gov/docs_AudioEngine.html

If you need a shorter delay than WASAPI Exclusive, you can play the sound through NI analog output with Stimulator or record the sound output with your recording system and calculate the onset time later.
Re: Delayed sound onset
August 03, 2022 02:47PM
Hi Jaewon,

Thank you for the information!
The WASAPI Exclusive mode provides very fast sound onsets.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.