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...".
Wav2txt
is
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
file
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
(GUI) )
- wav2txt_logo.bmp (the bitmap logo for the top of the GUI)
- wav2txt_top.pl (the perl source code, in case you want to
mess
with it)
- 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
to
launch the application.
If you have problems launching the Wav2txt
by
double clicking, try this method;
- Open a DOS window
- At the DOS prompt, CD (change default) into the wav2txt
folder
- At the DOS prompt, type "wav2txt.exe"
To use Wav2txt
- Click on the "Browse" button to
locate a
*.wav file you
wish to convert.
- By default the output file
("Out:")
will be placed in the same directory as the input file ("In:") and will
have a
.txt extension.
- You may manually edit the output
path
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
values column.
- 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
.txt2
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
file,
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
little information.
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
information.
How Wav2txt
was created
- 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
executable
with perlbin
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!