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

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



Dear Pawel,

That's very interesting, would you please elaborate a bit more on
that? What do you mean by "very low millisecond range"? Do you by-pass
the Windows kmixer, whose latency is 30 ms? I thought than only using
ASIO drivers or so-called "Kernel Streaming" which is available in
certain audio player application can by-pass the kmixer, and sound
produced with DirectSound has to have latency of ~30 ms.
Sorry, if was imprecise here: This solution does not provide any streaming support, but only plays sounds from (pre-loaded) buffers. With "latency" I referred to the delay between "play sound" command and actual sound onset (and not streaming input to output latency as used in relation with ASIO).

I have measured the delays this morning as I didn't remember the exact numbers: playsound command itself takes about 350 µs to execute, sound onset is about 400 µs after playsound returns (including some small trigger mex api overhead). Jitter is about 50 µs and clearly never above 100 µs (I did not see a single outlier in several thousand measurements this morning, but one day of course there will be one ;) That is, in our setup the trigger onset precedes sound onset by 400 µs with virtually no jitter (relative to our EEG sampling rates more than an order of magnitude longer).

As Cogent is closed source I do not know whether and how they bypass the kernel mixer, sorry (I asked them for source code access some years ago in order to add multichannel support, but did not get a positive response). In principle it should be possible to bypass kmixer also with DirectX (see e.g., http://msdn.microsoft.com/en-us/library/bb219700(VS.85).aspx), but I'm not sure whether this approach is really used in Cogent. Are you sure that the 30 ms latency refers to all (non-ASIO) hardware?

Hope this helps, best
Andreas

Daniel,

As for "synchronizing" the parallel port with sound onset: I don't
know if it will help you, but in my (previous) setup (which was for
single unit recordings, actually), I used a feedback solution similar
to Daniel's: a square pulse combined with the audio stimulus into a
stereo file to be played together.  The pulse was then converted to
TTL with an optocoupler, and read into the same computer via the
printer port, which was also used to read TTL inputs from the spike
discriminator. I was able to poll the port frequently enough to have
90% of poll-to-poll periods below 1 ms, and all (or close enough to
all) below 2 ms.  This was done with a custom-written software under
windows XP. So you could basically keep checking your printer port for
sound onset and upon detecting it immediately output your 8-bit
trigger via output lines of the printer port, if ~1ms accuracy is good
enough for you.

Pawel