nh2 / hemokit

Haskell library for the Emotiv EEG, inspired by the Emokit code
31 stars 13 forks source link

Hemokit is sending data too slowly #6

Open nh2 opened 9 years ago

nh2 commented 9 years ago

From https://github.com/nh2/hemokit/issues/4#issuecomment-77008453 with Openvibe:

Turning drift correction off in the Openvibe Acquisitor, I get after running it for 6000 seconds:

[  INF  ] Stopping the acquisition.
[WARNING] After 6013.4 seconds, theorical samples per second does not match real samples per second
[WARNING]   Received : 768928 samples
[WARNING]   Should have received : 769671 samples
[WARNING]   Drift was : -743 samples (-0.09%)
[WARNING]   The driver did not try to correct this difference
nh2 commented 9 years ago

I don't yet understand how this can happen, since we simply read from the HIDAPI device, and if our processing / code was too slow afterwards, the next read should make up for that (since data will be available earlier and read will return faster).

nh2 commented 9 years ago

As mentioned here the nominal sampling rate of the EPOC is 127.94Hz, so that's a bit slower than the 128Hz that Openvibe is expecting, but not 0.1% slower (instead, 1-127.94/128 = 0.046 %").

nh2 commented 9 years ago

Important to mention, the negative drift we're introducing is only introduced at certain times, e.g. every 10 seconds, and it always brings the drift down by ~7ms.

Since ~7ms is the time of one sample (~1/128), my suspicion is that Hemokit is dropping a data frame every now and then.

nh2 commented 9 years ago

Hmm, it's weird. I put in a check that looks whether the counter is not what it should be (+1) between two subsequently read frames, but this doesn't happen, so we really seem to receive all frames that the device generates, and not drop them ...