[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Solutions for sending triggers in an AEP (EEG) experiment?

On 9 Sep 2008 at 11:30, Pawel Kusmierek wrote:

> Hi all,
> Andreas:
> thanks for the information. It is quite possible that it 
was me who
> was imprecise or plainly wrong, probably because my 
knowledge of
> windows sound system was insufficient. I thought that 
unless a Kernel
> Streaming or ASIO driver is used, the delay from 
"playsound" to actual
> sound being started at the soundcard output must be 30 
ms. I think I
> need to read about this more thoroughly - although only 
for fun, as my
> current setup plays sounds and records neural (and other 
kind of) data
> in the same piece of hardware, so the processes are very 
> time-locked. So I don't have to worry about it anymore.

Note that the fact that the same piece of hardware is used
does not automatically assure time-locking under Windows, 
although for sound cards under DirectSound and later it at
least allows the possibility, if you don't also need to 
control sample rate. With the more primitive "wave" API 
functions synchrony typically depends upon sample rate, 
such that multiples or certain submultiples of the card's 
design rate (48000 Hz, usually) are synchronous, and other
sample rates like 44100 may drift.

Also, note that under Windows, using any Microsoft API tha
I know of, it is not possible to set or determine the sync
point... the input and output may be running at exactly the
same rate, but the alignment is unknown.  I have found that
(with wave API methods, at least) it's possible to get +/-
1 sample alignment (and usually 0) by careful attention to
the code that starts the input and output processes, along
with a one-time calibration process that generates pulses 
on the output and watches for them on the input to 
determine the time alignment.

Best regards,

 Bob Masta
            D A Q A R T A
Data AcQuisition And Real-Time Analysis
Scope, Spectrum, Spectrogram, Signal Generator
    Science with your sound card!