Audio delay

From TSG Doc
Revision as of 09:33, 7 March 2019 by Wilbert.vanham (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Audio delay is the time between the moment the experimenter want the audio to be played and the start of the audio playing. For experiments where no distinction is made between systematic and random errors in timing, the audio delay equals the accuracy of the onset of the audio stimulus.

Ways of measuring / definitions

Round trip test

This is the definition that we use most often, because it is relatively simple to measure. All you need is a computer with an analog audio output and a usb-port. The analog output can also be a different device that is controlled by the computer, for instance the Behringer.

  1. the audio stimulus is prepared
  2. a random delay is applied
  3. the virtual stopwatch is started
  4. the audio stimulus is started immediately after the stopwatch
  5. the line output of the audio hardware is connected to the sound or voice detector of the buttonbox
  6. the buttonbox reports receiving the audio, the virtual stopwatch is stopped

This loop is repeated a number of times to get a good estimate of the statistical distribution of the delay.

Oscilloscope test

This test more accurately measures the delay, since no loop back to the computer is needed. The test is more work to perform and therefore less useful for determining the statistical distribution of the delay.

  1. the audio stimulus is prepared
  2. a random delay is applied
  3. a trigger is sent to the buttonbox, the trigger shows on one channel of the oscilloscope
  4. the audio stimulus is started
  5. the line output of the audio hardware is connected to another channel of the oscilloscope
  6. the time difference between the onsets on the trigger and the audio signal is measured on the oscilloscope

Precision test

This test does not measure the audio delay itself, but only the precision. It can be combined with the previous tests. The difference is that step 3 and 4 are exchanged. This effectively deducts the time that sending the audio stimulus takes is deducted from the audio delay. If the audio is made with a synchronous function then this test is similar to how visual delay is measured.

Examples

Neurobs presentation

These are measurements of the audio delay in Neurobs Presentation on the Faculty of Social Sciences (DCC and BSI) labcomputer with three different settings (download the script here). Note that exclusive mode is most used in experiments and is the mode best comparable with for instance Linux Alsa. Shared mode is best comparable with Linux Jack.

In exclusive mode the histogram is square. The minimum delay is 15 ms, the maximum delay is 24 ms. This is caused by a single 10 ms buffer.

The maximum error is therefore 24 ms. When a distinction is made between accuracy and precision, the maximum accuracy error is 14 ms, the maximum precision error is 10 ms.

Note that for most experiments this is more than good enough.

Presentation, Exclusive Mode

Exclusive mode delay

Presentation, Shared Mode

Shared mode delay

Presentation, DirectX Mode

DirectX mode delay

Neurobs presentation, precision test

Since the audio call in Presentation is semi-synchronous (it waits till the sound starts playing) it is possible to know the audio onset with much higher precision by noting the time that the call ends. This way a precision of better than 3 ms is possible. If one does not need to control the moment the audio starts but only needs to know the moment, this is the value that should be called the onset precision.


Linux, Alsa, oscilloscope test

This is an example of an audio delay of 2 ms measured with the oscilloscope test.

Example audio delay of about 2ms using the osciloscope test.

This particular test was done on the labcomputer with a python script using ALSA, which is comparable with true exclusive mode, as it existed in MS Windows Xp, where the operating system allows only one program to control the audio hardware.