NeuropsyOL / RECORDA

Android Recorder for LSL streams in XDF Format
6 stars 6 forks source link

xdf file structure #1

Closed mgbleichner closed 4 years ago

mgbleichner commented 4 years ago

The xdf file seems to be not constructed correctly. The lab recorders writes the xml header for all streams at the beginning of the xdf file. Receiver interleaves xml headers and data.

AliAyub007 commented 4 years ago

@mgbleichner I am working on it. I'm having some issues with my machine so it's at service centre. I will share output on this soon.

AliAyub007 commented 4 years ago

@mgbleichner Can you kindly share that xdf file? I tested my files with latest version of xdf load function in Matlab and it is working.

s4rify commented 4 years ago

a) Fix: When writing some sections to the XDF file, the wrong "Stream ID" is specified. This allowed the individual parts of the file are not assigned to any stream or not to the correct stream.

b) Fix: The order of the sections ("chunks") was corrected so that they corresponds to the XDF specification [1]:

  1. stream header for all streams
  2. all content data for all streams
  3. stream footer for all streams

c) Extension: Timing offsets, which allow to define a relationship between timelines of the individual streams are created at two places in the XDF file is written:

  1. as "ClockOffset" chunks (see [1]) between header and footer. From this EEGLAB reads them.
  2. in the stream footer

    These timing offsets are collected per stream and every 5 seconds, just like LabRecorder does. The timing offset values are taken from LSL-Library provided. I have processed and saved it this way, how LabRecorder does it.

d) Change: Until now EEG recordings were always stored in a file named "default.xdf" is saved, even if the user has set a "default.xdf" in the settings. has selected another name. A file with this name already exists, which is usually the case after recording has already been done, is appended to this file. This usually results in several XDFs one after the other in one file.

I changed the choice of the file name so that automatically a fresh file name is selected for each recording. The names all start with "recording-" and contain date and time.

Author: Sören Jeserich