Next: WFDBF(3) Up: WFDB Applications Guide Previous: XFORM(1)On This Page


wfdb - Waveform Database library


#include <wfdb/wfdb.h>

int adumuv(WFDB_Signal s, WFDB_Sample adc_units)
double aduphys(WFDB_Signal s, WFDB_Sample adc_units)
char *anndesc(int annotation_code)
int annopen(char *record, WFDB_Anninfo *aiarray, unsigned int nann)
char *annstr(int annotation_code)
int calopen(char *calibration_filename)
char *datstr(WFDB_Date d)
char *ecgstr(int annotation_code)
int findsig(char *signal_name)
void flushcal(void)
WFDB_Frequency getafreq(void)
int getann(WFDB_Annotator a, WFDB_Annotation *annotation)
double getbasecount(void)
int getcal(char *description, char *units, WFDB_Calinfo *cal)
WFDB_Frequency getcfreq(void)
int getgvmode(void)
WFDB_Frequency getifreq(void)
int getseginfo(WFDB_Seginfo **segments)
char *getwfdb(void)
int getframe(WFDB_Sample *vector)
char *getinfo(char *record)
int getspf(void)
int getvec(WFDB_Sample *vector)
void iannclose(WFDB_Annotator a)
int iannsettime(WFDB_Time t)
int isgsettime(WFDB_Group signal_group, WFDB_Time t)
int isigopen(char *record, WFDB_Siginfo *siarray, int nsig)
int isigsettime(WFDB_Time t)
char *mstimstr(WFDB_Time t)
WFDB_Sample muvadu(WFDB_Signal s, int microvolts)
int newcal(char *calibration_filename)
int newheader(char *record)
void oannclose(WFDB_Annotator a)
int osigfopen(WFDB_Siginfo *siarray, unsigned int nsig)
int osigopen(char *record, WFDB_Siginfo *siarray, unsigned int nsig)
WFDB_Sample physadu(WFDB_Signal s, double v)
int putann(WFDB_Annotator a, WFDB_Annotation *annotation)
int putcal(WFDB_Calinfo *cal)
int putinfo(char *info)
int putvec(WFDB_Sample *vector)
WFDB_Frequency sampfreq(char *record)
WFDB_Sample sample(WFDB_Signal s, WFDB_Time t)
int sample_valid(void)
void setafreq(WFDB_Frequency annotation_clock_frequency)
int setanndesc(int annotation_code, char *annotation_description)
int setannstr(int annotation_code, char *annotation_mnemonic_string)
void setbasecount(double base_count)
int setbasetime(char *time_string)
void setcfreq(WFDB_Frequency counter_frequency)
int setifreq(WFDB_Frequency getvec_frequency)
void setwfdb(char *database_path_string)
int setecgstr(int annotation_code, char *annotation_mnemonic_string)
void setgvmode(int mode)
int setheader(char *record, WFDB_Siginfo *siarray, unsigned int nsig)
int setibsize(int size)
int setmsheader(char *record, char **seg_names, unsigned int nsegments)
int setobsize(int size)
int setsampfreq(WFDB_Frequency sampling_frequency)
int strann(char *annotation_mnemonic_string)
WFDB_Date strdat(char *date_string)
int strecg(char *annotation_mnemonic_string)
WFDB_Time strtim(char *time_string)
char *timstr(WFDB_Time t)
WFDB_Time tnextvec(WFDB_Signal s, WFDB_Time t)
int ungetann(WFDB_Annotator a, WFDB_Annotation *annotation)
const char *wfdbcflags(void)
const char *wfdbdefwfdb(void)
const char *wfdbdefwfdbcal(void)
char *wfdberror(void)
char *wfdbfile(char *type, char *record)
void wfdbflush(void)
int wfdbgetskew(WFDB_Signal s)
long wfdbgetstart(WFDB_Signal s)
int wfdbinit(char *record, WFDB_Anninfo *aiarray, unsigned int nann, WFDB_Siginfo *siarray, unsigned int nsig)

const char *wfdbldflags(void)
void wfdbmemerr(int exit_on_error)
int wfdbputprolog(char *prolog, long bytes, WFDB_Signal s)
void wfdbquiet(void)
void wfdbquit(void)
void wfdbsetskew(WFDB_Signal s, int skew)
void wfdbsetstart(WFDB_Signal s, long byte_offset)
void wfdbverbose(void)
const char *wfdbversion(void)


Waveform databases (including the MIT-BIH Arrhythmia Database, the AHA Database for Evaluation of Ventricular Arrhythmia Detectors, and the European ST-T Database) are accessible to applications written in C and C++ via the functions defined in the WFDB library. Under UNIX, programs may be linked with the WFDB library by using the -lwfdb option at the end of the C or C++ compiler command. The functions are described in detail in the reference below.


UNIX systems:

standard (statically bound) library
shareable library (bound at run-time, not available on all systems). On some systems, one of these pathnames is a link to the other, and both are needed; on others, only one of the pathnames is needed.
stubs for linking with applications that use (not needed on all systems).

The location of these files may vary on some systems.

MS-DOS/MS Windows systems:

standard (small memory model) library
large memory model library
dynamic link library for MS Windows
stubs for linking with applications that use wfdb.dll

See Also

WFDB Programmer’s Guide
On systems that support GNU emacs, the Guide may be available on-line using emacs info; from within emacs, type control-H followed by i to find out. An HTML version may be installed on your system (in /usr/help/html/wpg); the most recent version can be viewed on-line at

The WFDB library can also be used with Fortran programs; see wfdbf(3) and the Guide for details.


All functions that return an int indicate errors with negative values. Depending on context, zero returns may indicate success or failure. Positive values indicate success. Most errors other than EOF are accompanied by diagnostics on the standard error output.


George B. Moody (, with contributions from many sources. The predecessor of the WFDB library was originally implemented in C by George Moody and Ted Baker, based on earlier designs by Paul Schluter and Larry Siegal. Other contributors of code and ideas include Paul Albrecht, Mike Dakin, Phil Devlin, Scott Greenwald, David Israel, Roger Mark, Joe Mietus, and Warren Muldrow. Pat Hamilton and Bob Farrell contributed ports, to MacOS and Win32 respectively.


Table of Contents

Up: WFDB Applications Guide

Please e-mail your comments and suggestions to, or post them to:

MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 28 May 2015