Next: TIME2SEC(1) Up: WFDB Applications Guide Previous: SUMSTATS(1)On This Page


tach - heart rate tachometer


tach -r record -a annotator [ options ... ]


tach reads an annotation file (specified by the annotator and record arguments) and produces a uniformly sampled and smoothed instantaneous heart rate signal. Smoothing is accomplished by finding the number of fractional R-R intervals within a window (with a width of 2k output sample intervals, where k is a smoothing constant) centered on the current output sample. By default, the output is in text form, and consists of a column of numbers, which are samples of the instantaneous heart rate signal (in units of beats per minute). Optionally, the output sample number can be printed before each output sample value. Alternatively, tach can create a WFDB record containing the heart rate signal.

Studies of heart rate variability generally require special treatment of ectopic beats. Typically, ventricular ectopic beat annotations are removed from the input annotation file and replaced by ‘phantom’ beat annotations at the expected locations of sinus beats. The same procedure can be used to fill in gaps resulting from other causes, such as momentary signal loss. It is often necessary to post-process the output of tach to remove impulse noise in the heart rate signal introduced by the presence of non-compensated ectopic beats, especially supraventricular ectopic beats. Note that tach performs none of these manipulations, although it usually attempts limited outlier rejection (tach maintains an estimate of the mean absolute deviation of its output, and replaces any output that is more than three times this amount from the previous value with the previous value).

Options include:

-f time
Begin at the specified time in record (default: the beginning of record).
-F frequency
Produce output at the specified sampling frequency (default: 2 Hz).
Print a usage summary.
-i rate
For outlier detection, assume an initial rate of rate bpm (default: 80).
-l duration
Process the record for the specified duration, beginning at the time specified by a previous -f option, or at the beginning of the record.
-n n
Produce exactly n output samples, adjusting the output frequency so that they are evenly spaced throughout the interval specified by previous -f and -t or -l options. This option is particularly useful if the output of tach is to be used as input for a fast Fourier transform, since n can be chosen to be a convenient power of two.
-o record
Write output to signal and header files for the specified record (which should not be the same as the input record). This option suppresses the standard text output of tach.
Disable outlier rejection.
-s k
Set the smoothing constant to k (default: 1; k must be positive).
-t time
Process until the specified time in record (default: the end of the record).
Print the output sample number before each output sample value.
-V, -Vs, -Vm, -Vh
Print the output sample time in seconds (using -V or -Vs), minutes (using -Vm), or hours (using -Vh) before each output sample value. Only one of these options can be used at a time.

Reference (‘atr’) annotation files can be used as input to tach, but files that contain manually-inserted annotations are less suitable, since annotation placement is likely to be less consistent than in annotation files generated by programs such as sqrs(1) .


It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).


annotation buffer overflow
Use a smaller smoothing constant, a higher output frequency, or recompile tach with a larger value for ABL.

See Also

setwfdb(1) , sqrs(1)


George B. Moody (


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 10 June 2022