AudioFeedbackLatencyTest

>Psychtoolbox>PsychTests

AudioFeedbackLatencyTest([roundtrip=0][, trigger=0.1][, deviceid=auto][, nrtrials=10][, freq=auto][, freqout=auto][, fullduplex=0][, runmode=1])

Tries to test sound onset accuracy of PsychPortAudio without need for
external measurement equipment: Sound signals are played back via
PsychPortAudio at well defined points in time, using low-latency mode. At
the same time, sound is captured via PsychPortAudio’s capture facilities.
The idea is that the microphone or line-in connector should pick up and
capture the sound signals emitted through line-out (via a line-out ->
line-in feedback cable) or emitted through the speakers. We measure and
compare timing of emitted vs. captured sound spikes.

Results on MacbookPro, Windows, Linux, suggest that the method works, not with
100% accuracy, so its still better to use external measurement equipment to test!

EARLY BETA CODE: USE ONLY WITH GREAT CAUTION AND SUSPICION!

Optional parameters:

‘roundtrip’ If set to 0 then this measures scheduling accuracy of sound
onset, as measured by sound capture – should be no worse than ~ 1 msec
on a well working system, and input detection latency, ie., how long does
it take from physical sound onset to detection of sound onset by the
script. This would be a useful measure of how fast a “Voicekey” could
respond to voice onset in a best case scenario.

If set to 1 then this measures time from issuing the PsychPortAudio(‘Start’)
command to start playback until actual start of playback (by driver self-
assessment, and by measuring via audio capture), and also as “Roundtrip”
how long it would take to detect the onset by the script.

‘trigger’ = Trigger level for detection of sound onset in captured sound.

‘deviceid’ = Index of audio in/out device, if one device is used. If omitted,
the default audio device is chosen. You can also specify a vector of two device
indices, to specify separate input and output devices deviceid = [input, output].
With different devices, full-duplex mode is obviously not supported.

‘ntrials’ = Number of measurement trials to perform.

‘freq’ = Samplerate of capture device.

‘freqout’ = Samplerate of playback device.

‘fullduplex’ = Use soundcard in full-duplex mode.

‘runmode’ = Runmode for PsychPortAudio to choose.

Obviously this test function can only be used in a very silent room!

Path   Retrieve current version from GitHub | View changelog
Psychtoolbox/PsychTests/AudioFeedbackLatencyTest.m