14 Feb 2017
This code is pretty old (goes back to Win98) and probably needs to be recompiled using a
current windows based Perl compiler (or interpreter).
The program "Audacity" (http://www.audacityteam.org/ ) can read an audio file and export
the data as text. From the "Analyze" menu use "Sample data export...".
a windows program that converts a .wav format audio file
into a tab delimited text file suitable for loading into a spreadsheet
or other analysis program. This program was created to convert
recordings made using a PCs MIC input when it is used as a data logging
system and/or analog to digital converter.
To install Wav2txt
- Download this ZIP
into a convenient folder (probably named "Wav2txt") on your PC
- Unpack the zip file by double clicking on it
- The ZIP file contains;
- wav2txt.exe (the windows executable)
- wav2txt_gui.gld (the windows graphical user interface
- wav2txt_logo.bmp (the bitmap logo for the top of the GUI)
- wav2txt_top.pl (the perl source code, in case you want to
- Readme.txt (some info on installing and using)
- piezo2_mod.wav (a sample wav file for testing)
To launch Wav2txt
Double click on Wav2txt.exe
launch the application.
If you have problems launching the Wav2txt
double clicking, try this method;
- Open a DOS window
- At the DOS prompt, CD (change default) into the wav2txt
- At the DOS prompt, type "wav2txt.exe"
To use Wav2txt
- Click on the "Browse" button to
*.wav file you
wish to convert.
- By default the output file
will be placed in the same directory as the input file ("In:") and will
- You may manually edit the output
and/or file name in the "Out:" box.
- If the input file name is set
to *.wav then all wav files in the input directory will be converted.
- If you uncheck the "include
time column in output" then the output file will not include the time
- The "Trim Value" trims the
output of most data lines that have
|amplitudes| less than the Trim Value. A second output file, with a
.txt2 extension, is created that does not include these trimmed
data points. Only every 20th trimmed data point is included in the
file. Every data point greater than the "Trim Value" is included. This
trimming significantly reduces the size of the output file,
without losing any important data, and makes it easier to graph the
data. The .txt2 file always includes the time column.
- Click "Convert the file"
button to start the conversion.
Exactly What Does "Trim Value" Do?
One problem you have when you convert a wav file into a data
is that many spreadsheet programs limit the number of values you can
have in a table or graph. Since sound recordings generate at least
20,000 data points per second, it is easy to get a data set that is too
big for a spreadsheet to handle. If the recording is not of actual
sound, but of some kind of sensor data instead, then frequently the
majority of datapoints are "baseline" data which really contains very
For example, the graph below shows a small snippet, just 2.5
milliseconds long, of an "audio" recording made using phototransitors
to detect the BB's fired from a BB maching gun.
Blue dots mark the original data which was collected at 48,000 samples
per second. As you can see, the majority of datapoints really don't
contain useful information since we are really only interested in the
peaks, not long stretches of flat baseline. The "Trim Value" removes
most of the baseline data from the dataset. The example above shows a
Trim Value of +/-3 and the resulting datapoints that are retained in
the output marked with red boxes. The "Trim Value" retains all data greater
than the threshold
and every twentieth datapoint from the baseline regions. In this
example, the dataset size is reduced by about 85% without any loss of
- Wav2txt was written in Perl.
- The GUI (graphical user interface) was created using Loft.
- The GUI was implemented in Perl with Win32::GUI.
- The Perl program was converted to stand-alone windows
which allows it to run on a PC that doesn't have Perl installed.
Copyright ©2004 J. Sluka
Last Modified: 17 December 2004
Send me an email!