-> Home

Command line WAV-Utility

Version: 0.22

Introduction Usage Examples Download History Todo Contact


This program is mainly designed to perform some preprocessing to the creation of MPEG-Audio files from CD or disc. Some of the features are part of other applications like sox, too. But especially the normalization not only by peak value and the high performance subsonic filter is uncommon.

The main features are:

Currently only 16 bit uncompressed stereo files may be processed. Different sampling rates should be handled correctly.


WaveTool filename options

Use - as filename to read from stdin.

/z Global removal of DC offset.
/zm Removal of DC offset by moving average FIR filter.
The length of the filter kernel is defined by the /f option.
FIR subsonic filter with cutoff frequency [Hz].
If the frequency is omitted, a default value of 15 Hz is used. The filter kernel generator is always using a Hamming window function. The length of the filter kernel and with it the roll off is defined by the /f option. [1]
/Flength Length of FIR filter kernels.
This defines the length in seconds of FIR filters. Effectively this applies to /zm and /zf. By default 0.5s is used.
/a Disable advanced boundary conditions.
By default the audio data is extrapolated with the mean value of the first respectively the last half frame of data in case of a FIR filter. /a disables this feature and uses zero padding instead.
This is essentially useful if the audio data has a fade in with a DC offset and the slew rate is comparable to the FIR filter kernel length.
Calculate frame based peak loudness. [2]
The frame length is specified in seconds with a default of 1 s.
/lvalue Modify volume.
value may be a positive factor (1.0 equals 0 dB) or a negative dB goal. In case of the latter one the current volume is taken from the maximum RMS value per frame or from the peak level if /f is not used. /l0 without /f corresponds to a usual normalization.
/pfactor Modify volume only if the resulting factor is greater than factor or less than 1/factor respectively.
This is mainly intended for batch processing.
/s Use automatic volume scaling on per channel basis.
/n Do not add dithering noise during requantization.
Normally 1 LSB of random noise is added.
/c Disable automatic clipping check. Normally in case of automatic volume correction (/l-value) a clipping check is done, limiting the amplification factor to prevent clipping.
/cn Use nonlinear (soft) clipping. [3]
/C Report possible clippings of the unprocessed input data. [4]
/r filename is treated as raw PCM data with 44.1kHz stereo instead of RIFF WAVE.
/t Truncate any additional data beyond the data section of the wave file.
/v View detailed frame info.
This is for debugging purposes mainly.
/i Interactive mode. I.e. prompt for further options after analysis stage. At this point any of the options in this table may be specified. You have to omit the leading / and you must enter only one option per line. An empty line starts the execution.
/ofile Output file. By default the input file is used and the output is written in place.
/hfile Write value histogram of input data to ASCII file.
/kfile Use FIR filter kernel from file.
This implies an automatic /f according to the number of entries in file.
/Kfile Write FIR filter kernel to ASCII file.

  1. Although 3DNow-Instructions are used when available, this is very slow. It is not recommended to use this without a 3DNow capable CPU.
  2. Using /f the file is split into frames of specified length. For each frame the RMS volume is calculated. The maximum RMS value reached by this way is taken to be the maximum volume of the file for automatic loudness correction.
    This avoids the disadvantages of the peak level, which is very sensitive to glitches, and the RMS level, which is very sensitive to silent parts. Of course, at least a IIR filter should be applied to regard some psychoacoustics - but not within this release. However, this will always stay an approximation.
  3. The clipping function is the integral of 1/(1+x^4).
  4. Remember that all normalized input data will report at least one possible clipping.

Examples and hints

Generic analysis with interactive mode
WaveTool filename /i /f1
High quality 15 Hz subsonic filter with a transition bandwidth of around 10 Hz
WaveTool filename /F.3 /zf
Automatic loudness adjustment with DC offset removal
WaveTool filename /f /l-13 /p1.2 /zm
Analyze MP3 file
lame --decode --quiet filename - | WaveTool - /f
Generally, a moving average filter should be preferred over a global DC offset subtraction, because the computing time is normally neglectable. The filter kernel length should be long compared to the lowest frequencies. For instance 0.5 s.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU GENERAL PUBLIC LICENSE.

Version 0.21
ZIP file including OS/2 binary, source and this description

The OS/2 binary requires the gcc runtime libc06b2.dll to execute (LGPL).

Porting note: This program uses direct calls to the OS/2 file system API to improve performance. This will prevent easily porting. I will create a clib version by request. It also uses i86 assembler (NASM), but the alternative standard C-Code is already included.


Version 0.21

Version 0.2


  Improved loudness detection
A frequency weighted model should be use to get a more realistic approximation to the psychoacoustic loudness. This might be done by a fast IIR filter
  Handle more file formats
At the first other wave formats like mono files should be supported.
  Different (automatically generated) filter kernels
Besides /zf other filter kernels might be useful. For instance a 15.5 kHz low-pass for FM recordings. However, in case of MP3 this can be done implicitly by the band 21 cutoff.
  FFT filter engine
For most applications convolution by FFT is much faster than the direct way, because the complexity order is reduced from O(n2) to O(n log n).


Suggestions, help, complaints (but not too much:-): Mail-address: mueller-at-maazl-dot-de

Original homepage: http://www.maazl.de/project/audio/wavetool.html