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

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



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 well
time-locked. So I don't have to worry about it anymore.

Daniel:
it's up to you, I managed to get quite decent data doing all stuff
(sound playback, sound onset detection, spike TTL pulse recording,
behavioral control, etc.) in the same machine. Good luck to you.

Pawel


2008/9/8 Andreas Widmann <widmann@xxxxxxxxxxxxxx>:
> 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
>>
>



-- 
Pawel Kusmierek PhD
Department of Physiology and Biophysics
Georgetown University Medical Center
The Research Building WP23
3970 Reservoir Road NW
Washington, DC 20007
phone: +1 202 687-8851 or 8028, fax: +1 202 687-0617