Dear OpenEpys developers,
We're currently writing our own plugins to save neural data and ttl to a format compatible with our existing pipeline.
However, it seems that we have some synchronisation issue. On average, one out of several recordings, the neural signal is delayed for about 0.4s, compared to TTL/position data. We are confident with the delay, since the results/activity patterns seem right when we move the neural data forward by 0.4s compared to TTL/position data. This doesn't happen every time, so we could not figure out what led to the seemingly-random delays..
We wonder if others have encountered something similar or have any suggestions..
We use the following line to get startingTimestamp when calling void RecordEnginePlugin::writeTimestampSyncText(),
startingTimestamp = static_cast<double>(sampleNumber) / sourceSampleRate;
Our understanding is that this function gets called only once and the result serves for both TTL and neural data. Is that correct?
We then use the following functions to save TTL and spikes. Is there a chance that the two somehow arrives in a different way and leads to the issue...
writeEvent()
str_stream << "ttl_" << (ttl->getLine()+1) << " "
<< (eventStruct->getTimestampInSeconds() - startingTimestamp) << " "
<< (ttl->getState() ? '1' : '0') << "\r\n";
and writeSpike()
int32_t timestamp = BSWAP32(static_cast<int32_t>((spike->getTimestampInSeconds() - startingTimestamp) * timestampTimebase));
Here is the entire code.
Thank you in advance for any advice.
Best,
Guifen