wav2mit, mit2wav - convert between .wav and WFDB-compatible formats
wav2mit
-i file.wav [ options ... ]
mit2wav -o file.wav -r record [ options ... ]
These programs convert
files in the widely-used .wav audio file format into WFDB format files (as
used in PhysioBank) and vice versa. Most .wav files are already written in
a WFDB-compatible format, although the reverse is not true. (An embedded
header is required by .wav format, and is allowed but is not usually present
in WFDB-format signal files.)
wav2mit creates a WFDB record from file.wav.
If the input file is written in an MIT-compatible signal file format, all
that is required in this case is to create a suitable WFDB-format .hea header
file that describes the .wav file’s format. Some .wav files are written using
variants of the format that are not readable by the WFDB library; the
current version of wav2mit does not attempt to convert such files, but
warns that they are not compatible. Options for wav2mit include:
- -h
- Print
a brief usage summary.
- -r record
- Create the specified record (default: use
the base name of the input file as the record name).
mit2wav reads the specified
WFDB-format record (header and signal files) and creates a .wav file containing
the same data. Note that much of the data description contained in the
WFDB-format header file cannot be preserved in the .wav file. Options for
mit2wav include:
- -h
- Print a brief usage summary.
- -n record
- Create a header
file for the output (.wav) signal file, so that it can be read by WFDB applications
as the specified record.
It may be possible to create analog signals by
playing the .wav file through a sound card, but you should be aware of the
following potential pitfalls:
- Your sound card, and the software that comes
with it, may not be able to
- play .wav files containing three or more signals.
If this is a problem, you will need to extract one or two signals to include
in the .wav file from your original recording (for example, using xform(1)
).
- Your sound card and its software may be unable to play .wav files at
- other
than certain fixed sampling frequencies (typically 11025, 22050, and 44100
Hz). If this is a problem, you will need to resample the input at one of
the frequencies supported by your sound card (for example, using xform(1)
)
before converting it to .wav format using this program.
- Your sound card may
not be able to reproduce the frequencies present in
- the input. This is
very likely if you are trying to recreate physiologic signals such as ECGs
(with most of the useful information in the 0.1 to 30 Hz band) using a consumer
sound card (which probably does not reproduce frequencies below the lower
limit of human hearing (around 30 Hz). One possible solution to this problem
is to create a digital signal containing a higher-frequency carrier signal,
amplitude-modulated by the signal of interest, and to convert this AM signal
into a .wav file; on playback, an analog AM demodulator would then recover
the original low-frequency signal of interest. If you successfully implement
this solution, please send details to the author.
It may be necessary
to set and export the shell variable WFDB (see setwfdb(1)
).
These
programs are provided in the convert directory of the WFDB Software Package.
Run make in that directory to compile and install them if they have not
been installed already.
a2m(1)
, edf2mit, snip(1)
, xform(1)
, wfdb(3)
,
header(5)
George B. Moody (george@mit.edu)
http://www.physionet.org/physiotools/wfdb/convert/wav2mit.c
http://www.physionet.org/physiotools/wfdb/convert/mit2wav.c
Table of Contents
Up: WFDB Applications Guide
Please e-mail your comments and suggestions to webmaster@physionet.org, or post them to:
PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA
Updated 10 June 2022