Distortion and clipping, C++ program for automatic detection and metering

We have developed an algorithm which will analyse an audio file and detect clipping type distortions that can occur for example, when a microphone preamp has been overloaded, or when a automatic gain reduction system or limiter is performing poorly.  The algorithm produces a perceptually weighted value of the level of distortion in an audio file.

The algorithm is available as a C++ program (requires compiling using a C++ compiler) and runs as a command line executable which analyses a wavfile and provides information as regards the level, location and effect on quality of any distortion that may be present.

The program is available, free under the MIT license : https://github.com/kenders2000/distortionDetection



Wav files must be 16 or 32 bit int, or 32 bit float PCM. All channels are collapsed to one (average of all channels).  If you use the code please cite the following reference: TBC This program automatically analyses .wav files and detects regions where there may distortion due to overloading. This tool could be used when there are a large number of recordings of a particular source, for example clips of recordings from mobile devices of an outdoor concert (user generated content).

This tool can quickly analyse the audio from each to determine samples with the least amount of distortion and therefore of the highest quality. The distortion detection algorithm also provides time stamps identifying the regions which are distortion free. This can allow producers to quickly stitch together content from multiple sources, or flag regions where extra processing such as noise reduction is required. Perceptual tests have shown that when distortion is present in speech music and other signals the HASQI (Hearing Aid Sound Quality index) is a good indicator of the quality of the recording for both normal and hearing impared listeners. Therefore this detector works by trying to predict the HASQI which in turn indicates the possible degradation to the audio quality.