EDF/BDF test file generator

A commandline tool that generates files in the European Data Format (16-bit and 24-bit (BDF)), containing a signal with sine, square, ramp, triangular or noise waveform.
Samplefrequency, signalfrequency, dutycycle, amplitude, phase and number of signals can be freely chosen.
System requirements: GNU/Linux & GCC & Make.
Gitlab repo: https://gitlab.com/Teuniz/edf-test-generator-console


Compiling on Debian Linux and derivatives   (Ubuntu, Mint, Raspberry Pi OS, etc.)

Simply execute the following commands in a terminal:


  sudo apt update
  sudo apt install gcc make git
  git clone https://gitlab.com/Teuniz/edf-test-generator-console.git
  cd edf-test-generator-console
  make -j8


Compiling on Fedora

Simply execute the following commands in a terminal:


  sudo dnf update
  sudo dnf install gcc make git
  git clone https://gitlab.com/Teuniz/edf-test-generator-console.git
  cd edf-test-generator-console
  make -j8


Compiling on openSUSE

Simply execute the following commands in a terminal:


  sudo zypper refresh
  sudo zypper install -t pattern devel_basis devel_C_C++
  git clone https://gitlab.com/Teuniz/edf-test-generator-console.git
  cd edf-test-generator-console
  make -j8

Usage


 Usage: edfgenerator [OPTION]...

 options:

 --type=edf|bdf default: edf

 --len=file duration in seconds default: 30

 --rate=samplerate in Hertz default: 500 (integer only)

 --freq=signal frequency in Hertz default: 10 (may be a real number e.g. 333.17)

 --wave=sine | square | ramp | triangle | white-noise | pink-noise default: sine

 --dcycle=dutycycle: 0.1-100% default: 50

 --phase=phase: 0-360degr. default: 0

 --physmax=physical maximum default: 1200 (may be a real number e.g. 1199.99)

 --physmin=physical minimum default: -1200 (may be a real number e.g. -1199.99)

 --amp=peak amplitude default: 1000 (may be a real number e.g. 999.99)

 --unit=physical dimension default: uV

 --digmax=digital maximum default: 32767 (EDF) or 8388607 (BDF) (integer only)

 --digmin=digital minimum default: -32768 (EDF) or -8388608 (BDF) (integer only)

 --offset=physical dc-offset default: 0

 --datrecs=number of datarecords that will be written into the file, has precedence over --len.

 --datrec-duration=duration of a datarecord in seconds default: 1 (may be a real number e.g. 0.25)
                   effective samplerate and signal frequency will be inversely proportional to the datarecord duration

 --signals=number of signals default: 1 in case of multiple signals, signal parameters must be separated by a comma e.g.: --rate=1000,800,133

 --merge  merge all signals into one trace, requires equal samplerate and equal physical max/min and equal digital max/min and equal physical dimension (units) for all signals

 --delay=milliseconds  emulate streaming by going to sleep for n milliseconds after writing each datarecord, default is 0 (no delay)

 --annot-chan-pos=before | middle | after   default: after
                  whether the annotation channel will be put before, in the middle or after the regular channels

 --help

 Note: decimal separator (if any) must be a dot, do not use a comma as a decimal separator


 examples:

 edfgenerator --type=bdf --len=60 --rate=44000 --freq=1000 --wave=square --dcycle=15 --unit=V --offset=500 --physmax=5000

 edfgenerator --type=edf --len=30 --signals=5 --rate=1000,800,500,975,999 --freq=5,13,7,1,1 --wave=sine,square,ramp,pink-noise,white-noise --dcycle=50,25,75,50,50 --unit=uV,uV,uV,uV,uV --physmax=3000,3000,3000,3000,3000 --physmin=-3000,-3000,-3000,-3000,-3000 --datrec-duration=0.5 --annot-chan-pos=middle

 merge 3 sine waves into one trace:

 edfgenerator --type=edf --len=30 --signals=3 --rate=1000,1000,1000 --freq=5,15,25 --wave=sine,sine,sine --unit=uV,uV,uV --amp=200,66.667,40 --physmax=3000,3000,3000 --physmin=-3000,-3000,-3000 --merge

Examples


 edfgenerator --type=edf --len=10 --rate=1000 --freq=1 --wave=sine 

EDF file, 10 seconds recording length, 1KHz samplerate, sine wave of 1Hz


 edfgenerator --type=edf --len=30 --rate=113 --freq=3.2 --wave=square --dcycle=50 --physmax=3200 --physmin=-3200 --amp=100 --unit=uV 

EDF file, 30 seconds recording length, 113Hz samplerate, square wave of 3.2Hz, duty cycle 50%,
3200 physical maximum, -3200 physical minimum, 100uV peak amplitude


 edfgenerator --type=bdf --len=10 --rate=1000 --freq=1.5 --wave=ramp --dcycle=10.5 --physmax=1000 --physmin=-1000 --amp=300 --unit=mV --digmax=1048575 --digmin=-1048576 

BDF file, 10 seconds recording length, 1KHz samplerate, ramp wave of 1.5Hz, duty cycle 10.5%,
1000 physical maximum, -1000 physical minimum, 300mV peak amplitude, 1048575 digital maximum, -1048576 digital minimum


 edfgenerator --type=bdf --len=20 --rate=512 --freq=3.7 --wave=triangle --dcycle=100 --physmax=1000 --physmin=-1000 --amp=300 --unit=uV 

BDF file, 20 seconds recording length, 512Hz samplerate, triangular wave of 3.7Hz, duty cycle 100%,
1000 physical maximum, -1000 physical minimum, 300uV peak amplitude


 edfgenerator --type=bdf --len=20 --rate=512 --freq=3.7 --wave=triangle --dcycle=10 --physmax=1000 --physmin=-1000 --amp=300 --unit=uV 

BDF file, 20 seconds recording length, 512Hz samplerate, triangular wave of 3.7Hz, duty cycle 10%,
1000 physical maximum, -1000 physical minimum, 300uV peak amplitude



Feedback to: teuniz@protonmail.com


Other EDF software


A very convenient open-source programming library for C/C++ programmers who want to implement EDF(+) and/or BDF(+):


More info