Difference between revisions of "Audio delay"
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
For experiments where no distinction is made between systematic and random errors in timing, the audio delay equals the accuracy | 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. | 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. | ||
+ | # the audio stimulus is prepared | ||
+ | # a random delay is applied | ||
+ | # the virtual stopwatch is started | ||
+ | # the audio stimulus is started immediately after the stopwatch | ||
+ | # the line output of the audio hardware is connected to the sound or voice detector of the buttonbox | ||
+ | # 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. | ||
+ | # the audio stimulus is prepared | ||
+ | # a random delay is applied | ||
+ | # a trigger is sent to the buttonbox, the trigger shows on one channel of the oscilloscope | ||
+ | # the audio stimulus is started | ||
+ | # the line output of the audio hardware is connected to another channel of the oscilloscope | ||
+ | # 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 == | == Neurobs presentation == | ||
These are measurements of the audio delay in Neurobs Presentation on the Faculty of Social Sciences (DCC and BSI) labcomputer | These are measurements of the audio delay in Neurobs Presentation on the Faculty of Social Sciences (DCC and BSI) labcomputer | ||
− | with three different settings. Note that exclusive mode is most used in experiments and is the mode best comparable with for | + | with three different settings ([https://gitlab.socsci.ru.nl/tsg/performance-tests/tree/master/Presentation/audio/SoundLatencyTest 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. | instance Linux Alsa. Shared mode is best comparable with Linux Jack. | ||
Line 14: | Line 43: | ||
Note that for most experiments this is more than good enough. | Note that for most experiments this is more than good enough. | ||
− | |||
− | |||
=== Presentation, Exclusive Mode === | === Presentation, Exclusive Mode === | ||
[[File:Exclusive mode.png|border|Exclusive mode delay]] | [[File:Exclusive mode.png|border|Exclusive mode delay]] | ||
Line 23: | Line 50: | ||
[[File:Directx.png|border|DirectX mode delay]] | [[File:Directx.png|border|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''. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | This is an example of audio delay of 2 ms measured with the oscilloscope test. | + | == Linux, Alsa, oscilloscope test == |
+ | This is an example of an audio delay of 2 ms measured with the oscilloscope test. | ||
[[File:Alsa.png|border|Example audio delay of about 2ms using the osciloscope test.]] | [[File:Alsa.png|border|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 | |
− | This test | + | system allows only one program to control the audio hardware. |
− | |||
− | |||
− |
Latest revision as of 09:33, 7 March 2019
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.
- the audio stimulus is prepared
- a random delay is applied
- the virtual stopwatch is started
- the audio stimulus is started immediately after the stopwatch
- the line output of the audio hardware is connected to the sound or voice detector of the buttonbox
- 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.
- the audio stimulus is prepared
- a random delay is applied
- a trigger is sent to the buttonbox, the trigger shows on one channel of the oscilloscope
- the audio stimulus is started
- the line output of the audio hardware is connected to another channel of the oscilloscope
- 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
Presentation, DirectX Mode
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.
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.