What is the .bdf file format? (BioSemi Data Format)
 
For the new ActiveTwo system, we use the BioSemi Data Format. BDF is a 24 bit version of the popular 16 bit EDF format, which was used on previous BioSemi models with 16 bit converters. BDF is almost the same as EDF (see the full specifications and differences of the BDF/EDF file formats in the 2 tables below. Although initially the EDF format was mainly used in sleep research, BDF/EDF is now quickly gaining popularity in other EEG applications, ECG body surface potential mapping as well as EMG.
BESA, Sourcesignal and Persyst are fully compatible with BDF.
 
The EDF format was designed and published in 1992 by Bob Kemp, Alpo Värri, Agostinho C. Rosa, Kim D. Nielsen and John Gade as "A simple format for exchange of digitized polygraphic recordings" in Electroencephalography and Clinical Neurophysiology, 82 (1992) 391-393. The original EDF specifications can be found here
 
Each BDF/EDF file starts with a header followed by the number of Data records indicated in the header.
 
The last channel of a BDF file is always the Trigger Status channel.
       
Length in bytes BDF Header: EDF Header: Description
8 bytes Byte 1: "255" (non ascii) Byte 1: "0" (ASCII) Identification code
Bytes 2-8 : "BIOSEMI" (ASCII) Bytes 2-8 : " "(ASCII)
80 bytes
User text input (ASCII)
Local subject identification
80 bytes
User text input (ASCII)
Local recording identification
8 bytes
dd.mm.yy (ASCII)
Startdate of recording
8 bytes
hh.mm.ss (ASCII)
Starttime of recording
8 bytes
(ASCII)
Number of bytes in header record
44 bytes
"24BIT" (ASCII)
"BIOSEMI" (ASCII)
Version of data format.
8 bytes
(ASCII)
Number of data records "-1" if unknown
8 bytes
e.g.: "1" (ASCII)
Duration of a data record, in seconds
4 bytes
e.g.: "257" or "128" (ASCII)
Number of channels (N) in data record
N x 16 bytes
e.g.: "Fp1", "Fpz", "Fp2", etc (ASCII)
Labels of the channels
N x 80 bytes
e.g.: "active electrode", "respiration belt" (ASCII)
Transducer type
N x 8 bytes
e.g.: "uV", "Ohm" (ASCII)
Physical dimension of channels
N x 8 bytes e.g.: "-262144" (ASCII) e.g.: "-32768" (ASCII) Physical minimum in units of physical dimension
N x 8 bytes e.g.: "262143" (ASCII) e.g.: "32767" (ASCII) Physical maximum in units of physical dimension
N x 8 bytes e.g.: "-8388608" (ASCII) e.g.: "-32768" (ASCII) Digital minimum
N x 8 bytes e.g.: "8388607" (ASCII) e.g.: "32767" (ASCII) Digital maximum
N x 80 bytes e.g.: "HP:DC; LP:410" e.g.: "HP:0,16; LP:500" Prefiltering
N x 8 bytes
For example: "2048" (ASCII)
Number of samples in each data record
(Sample-rate if Duration of data record = "1")
N x 32 bytes
(ASCII)
Reserved
     
  Note1: Total header length (for BDF and EDF) is: {(N+1)*256} bytes, where N is number of channels (including the status channel).
  Note2: The "gain" of a specific channel can be calculated by: (Physical max - Physical min) / (Digital max - Digital min).
    The result is the LSB value in the specified Physical dimension of channels. (31,25nV / 1uV in the BDF/EDF example Header from above)
  Note3: The last 10 fields are defined for each fields separately. Each channel can be different.
     
 
Below follows an example of a BDF Data Record from 16 electrodes at 2048Hz samplerate. (BDF file is 16+1 channels) (16 electrodes + Trigger/Status channel)
(Duration of a data record has been set to "1")
 
Byte in file
Which part of 24 bit
Which channel
Which sample of data record
Which data record
1
2
3
Byte 1
Byte 2
Byte 3
Channel 1
1
Duration of data set has been set to "1". So this block will be filled with (1x2048) samples from only "Channel 1"
1
4
5
6
Byte 1
Byte 2
Byte 3
Channel 1
2
7
8
9
Byte 1
Byte 2
Byte 3
Channel 1
3

etc.

Channel 1: sample 4 to sample 2045

 

6136
6137
6138
Byte 1
Byte 2
Byte 3
Channel 1
2046
6139
6140
6141
Byte 1
Byte 2
Byte 3
Channel 1
2047
6142
6143
6144
Byte 1
Byte 2
Byte 3
Channel 1
2048
6145
6146
6147
Byte 1
Byte 2
Byte 3
Channel 2
1
Duration of data set has been set to "1". So this block will be filled with (1x2048) samples from only "Channel 2"
6148
6149
6150
Byte 1
Byte 2
Byte 3
Channel 2
2
6151
6152
6153
Byte 1
Byte 2
Byte 3
Channel 2
3

etc.

Channel 2: sample 4 to sample 2045

 

12280
12281
12282
Byte 1
Byte 2
Byte 3
Channel 2
2046
12283
12284
12285
Byte 1
Byte 2
Byte 3
Channel 2
2047
12286
12287
12288
Byte 1
Byte 2
Byte 3
Channel 2
2048

etc.

Channel 03: sample 1 to sample 2048
Channel 04: sample 1 to sample 2048
Channel 05: sample 1 to sample 2048
Channel 06: sample 1 to sample 2048
Channel 07: sample 1 to sample 2048
Channel 08: sample 1 to sample 2048
Channel 09: sample 1 to sample 2048
Channel 10: sample 1 to sample 2048
Channel 11: sample 1 to sample 2048
Channel 12: sample 1 to sample 2048
Channel 13: sample 1 to sample 2048
Channel 14: sample 1 to sample 2048
Channel 15: sample 1 to sample 2048

 

This block will be filled with (13x2048) samples from "Channels 3-15"
92161
92162
92163
Byte 1
Byte 2
Byte 3
Channel 16 1 This block will be filled with (1x2048) samples from "Channel 16"
92164
92165
92166
Byte 1
Byte 2
Byte 3
Channel 16 2
92167
92168
92169
Byte 1
Byte 2
Byte 3
Channel 16 3

etc.

Channel 16: sample 4 to sample 2045

 

98296
98297
98298
Byte 1
Byte 2
Byte 3
Channel 16
2046
98299
98300
98301
Byte 1
Byte 2
Byte 3
Channel 16
2047
98302
98303
98304
Byte 1
Byte 2
Byte 3
Channel 16
2048
98305
Byte 1
Trigger LowByte
1 This block will be filled with (1x2048) samples from the Trigger/Status Channel
98306
Byte 2
Trigger HighByte
98307
Byte 3
StatusByte
98308
Byte 1
Trigger LowByte
2
98309
Byte 2
Trigger HighByte
98310
Byte 3
StatusByte
98311
Byte 1
Trigger LowByte
3
98312
Byte 2
Trigger HighByte
98313
Byte 3
StatusByte

etc.

Trigger/Status Channel: samples 4 to sample 2045

 

104440
Byte 1
Trigger LowByte
2046
104441
Byte 2
Trigger HighByte
104442
Byte 3
StatusByte
104443
Byte 1
Trigger LowByte
2047
104444
Byte 2
Trigger HighByte
104445
Byte 3
StatusByte
104446
Byte 1
Trigger LowByte
2048
104447
Byte 2
Trigger HighByte
104448
Byte 3
StatusByte
104448
104449
104450
Byte 1
Byte 2
Byte 3
Channel 1
1
This block will be filled with (1x2048) samples from only "Channel 1" 2
104451
104452
104453
Byte 1
Byte 2
Byte 3
Channel 1
2
etc
etc
etc
etc
 
A zip file with two BDF test files can be downloaded from here.
This zip file contains 2 DBF files each with 60 seconds of a 17 channels measurement (channels A1 to A16 + Status), one file has 2048 Hz sample rate, the other has 256 Hz. The files have a 3Hz sine test signal on all channels for easy checking (approx. 200 uVpp on channels A1, approx. 100 uV in opposite polarity on channels A2 to A16).