The Total Harmonic Distortion component determines the total harmonic distortion (THD) over the given period .
Consider that the input consists of harmonic RMS components , , , etc. The total RMS component is then determined by:
The calculation of the total harmonic distortion is based on the parameter . The default value represents the standard THD calculation used in electrical engineering http://www.electropedia.org/iev/iev.nsf/display?openform&ievref=551-20-13 . The non-default value calculates the THD typically used for the assessment of audio signals. If , the total higher harmonic content (harmonic order numbers > 1) refers to the RMS value of the fundamental wave:
If , the total higher harmonic content (harmonic order numbers > 1) refers to the total RMS:
In case of a zero input signal or within the first period of calculation, the boolean output signal becomes to indicate that the calculation result is not valid. Valid calculations are indicated by .