thd n measurement with tone-凯发k8网页登录
this example shows how to measure total harmonic distortion and noise level of audio input and output devices.
introduction
audio input and output devices are non-linear in nature. this causes harmonic distortion in the audio signal. apart from the unwanted signals that may be harmonically related to the signal, these devices can also add uncorrelated noise to the audio signal.
total harmonic distortion and noise (thd n) quantifies the sum of these two distortions. it is defined as the root mean square (rms) level of all harmonics and noise components over a specified bandwidth. the signal level is also specified as a reference.
measurement of thd n
this example introduces a reference model that can be used for thd n measurements of audio input and output devices. the steps involved in measurement are:
generate a pure sine wave of a specific frequency.
play the signal through an audio output device and record it through an audio input device.
from the recorded signal, identify the sine wave peak. this will give the reference signal rms level.
remove the identified sine wave from recorded signal. what remains is everything unwanted, and its rms will give thd n value.
this example follows the aes17-1998(r2004) [1] standard for thd n measurement. the standard recommends a 997 hz frequency sine wave. it also recommends a notch filter having q between 1 and 5 for filtering out the sine wave from recorded signal. a q value of 5 is used in this example.
the audiothdnmeasurementexample
model implements a reference system for measuring thd n. following the aes17-1998(r2004) standard, the sine wave source test tone
generates a frequency of 997 hz. the subsystem system under test
is a variant subsystem. by default, it selects a non-linear model implemented in simulink for measuring the thd n. to perform the measurement on your machine's audio input and output device, set the sut
variable in base workspace to thdndemosut.audiohardware.
the measurement is done by the thd n measurement
subsystem.
dual-bandpass controller
the measurement system in the model uses a dual-peak tracking filter to locate the notch at the test tone's fundamental. this accommodates signal generators that are not synchronized to the adc clock. the output of this block is the center frequency coefficient of the notch filter that will be used to extract the test sine tone. the two peaking filters in the controller are implemented using system objects. when the model is run, the feedback loop works to adjust the center frequencies of the two peaking filters in such a way that the output locks on to the peak tone of the input.
notch-peak filter
once the frequency of the sine wave has been identified, pass it to a peaking filter to extract the test tone signal. this will be used to determine the test signal's peak level. a notch filter will then use the same center frequency to remove the sine wave. the remaining signal is the sum of the total harmonic distortion and noise. use a single dsp.notchpeakfilter
to get both - notch and peak outputs. the q-factor of this filter is chosen as 5, conforming to aes17-1998 standard.
thd n computer
the thd n computer
subsystem mimics a signal level meter. it takes the notch and peak outputs and smooths them using a lowpass filter. it then converts the level of the signals to db.
you can run the model and see the displays update with measured sine wave frequency, thd n level in db, and reference signal level in db.
references
[1] aes17-1998 "aes standard method for digital audio engineering - measurement of digital audio equipment", audio engineering society (1998), r2004.