InitializePsychSound([reallyneedlowlatency=0])
This routine loads the
PsychPortAudio sound driver for high-precision,
low-latency, multi-channel sound playback and recording.
Call it at the beginning of your experiment script, optionally providing
the 'reallyneedlowlatency' flag set to one to push really hard for low
latency.
On
MacOS/X and GNU/Linux, the
PsychPortAudio driver will just work with
the lowest possible latency and highest timing precision after this
initialization.
By default
PsychPortAudio on Windows will use the "portaudio_x86.dll"
low-level sound driver included in the Psychtoolbox/
PsychSound/
subfolder. This driver supports the Windows MME (
MultiMediaExtensions)
and
DirectSound sound systems. Apart from being buggy on some systems,
these sound systems only have a mildly accurate timing and a fairly high
inherent latency, typically over 30 milliseconds. On 150$ class sound
hardware we were able to achieve a trial-to-trial sound onset variability
with a standard deviation of about 1 millisecond, which is still good
enough for many purposes.
The driver also supports the ASIO sound system provided by professional
class sound cards. If you need really low latency or high precision sound
on Windows, ASIO is what you want to use: Some (usually more expensive >
150$) professional class sound cards ship with ASIO enabled sound
drivers, or at least there's such a driver available from the support
area of the website of your sound card vendor.
Disclaimer: "ASIO is a trademark and software of Steinberg Media
Technologies
GmbH."
For cards without native ASIO drivers, there's the free ASIO4ALL driver,
downloadable from
http://asio4all.com, which may or may not work well on
your specific sound card - The driver emulates the ASIO interface on top
of the WDM-KS (Windows Driver Model Kernel Streaming) API from Microsoft,
so the quality depends on the underlying WDM driver. If you manage to get
such an ASIO enabled sound driver working on your sound hardware, and
your ASIO enabled driver and sound card are of sufficiently high quality,
you can enjoy latencies as low as 5 msecs and a sound onset accuracy with
a standard deviation from the mean of less than 0.1 milliseconds on
MS-Windows - We measured around 20 microseconds on some setups, e.g., the
M-Audio Delta 1010-LT soundcard under Windows-XP SP2.
Using OS/X or Linux will usually get you comparably good or better
results with standard sound hardware.
Psychtoolbox/PsychSound/InitializePsychSound.m