Wav2txt Logo

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

  1. Download this ZIP file into a convenient folder (probably named "Wav2txt") on your PC
  2. Unpack the zip file by double clicking on it
  3. The ZIP file contains;

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;

  1. Open a DOS window
  2. At the DOS prompt, CD (change default) into the wav2txt folder
  3. At the DOS prompt,  type "wav2txt.exe"

To use Wav2txt

  1. Click on the "Browse" button to locate a *.wav file you wish to convert.
  2. By default the output file ("Out:") will be placed in the same directory as the input file ("In:") and will have a .txt extension.
  3. You may manually edit the output path and/or file name in the "Out:" box.
  4. If the input file name is set to *.wav then all wav files in the input directory will be converted.
  5. If you uncheck the "include time column in output" then the output file will not include the time values column.
  6. 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.
  7. 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

Copyright 2004 J. Sluka
Last Modified:  17 December 2004
Send me an email!