diyAudio

diyAudio (https://www.diyaudio.com/forums/index.php)
-   Everything Else (https://www.diyaudio.com/forums/everything-else/)
-   -   THD measurement - how to? (https://www.diyaudio.com/forums/everything-else/132748-thd-measurement.html)

okapi 8th November 2008 01:56 AM

THD measurement - how to?
 
i am writing a set of procedures for amp and speaker evaluation. I have a early version up and running but my THD measurement is higher than expected for a LM3875 based amp. This result made me wonder if my method for calculating THD was correct.

The type of data i am trying to produce is similar to the following:
An externally hosted image should be here but it no longer works. Please upload images instead of linking to them to prevent this.


presently, i am scaling the the control wave (the wave output by the sound card before running it through the amp), a frequency sweep, to the amplified waveform and then subtracting the two. I then express the amplitude of the subtraction wave as a percent of the amplified wave. This measurement would/should include both phase and amplitude distortion.

there is the possibility that my amp is distorting as much as measured but since i just intuited my way to the measurement method i thought i would make sure i am doing it correctly first.

summary: what is the method for obtaining THD measurement from a frequency sweep?

bwaslo 8th November 2008 03:09 AM

Getting a THD measurement from a frequency sweep will only work if you have some sort of tracking filter to separate the harmonics from the fundamental, and then calculate from all their relative levels. Incidentally, phase distortion has NO CONTRIBUTION to THD, THD is harmonic amplitude only. If your measurement is affected by phase response, then you aren't measuring THD (not that phase distortion is irrelevant, but it isn't involved in THD).

As far as I know, the only practical way to get THD using a frequency sweep and only a soundcard is with software that can operate with a logarithmic swept sinewave and a very clever and sophisticated technique called "Farina's method" that extracts impulse response of the fundamental and separate impulse responses of each harmonic product. I don't know of any freeware way to do it, though.

Your best bet is to just measure at single frequencies individually, use some kind of FFT analysis program to show the fundamental level and the level of each harmonic tone. Then, THD is the ratio of the RMS summation of all the harmonics to the RMS summation of fundamental along with harmonics. If one harmonic is much stronger than all others, then you'll be pretty close if you just take the ratio of the level of that one to the fundamental tone's level.

If you're doing it with a soundcard, also be sure that you are operating near the full scale levels (that is, just below clipping) of both the playback (D/A) and record (A/D) converters. Else, you won't be able to get residual distortion of your test setup down very far -- you need to use all the bits of resolution your soundcard has available.

okapi 8th November 2008 03:48 AM

bwaslo, your reply is very helpful - thank you. i am a biologist trying to find my way in an engineering world. i have a few follow up thoughts.

1. it looks like i will have to obtain my distortion vs frequency plot from discrete points (something i already have partially implemented). I will also look into the Farina method as i am writing the code myself (in igor pro from wavemetrics) and have already implemented a log swept sin wave.

2. would an alternative method to calculate THD from a frequency sweep be to remove the phase distortion before subtracting the waves as i already do?. For example, i could select a filter that matches the phase roll off i measure, and then use those filter parameters to remove the phase shift from the amps output. or is this just crazy talk.

3. i do think my measurement has some appeal as it is a way of showing the effect of phase and amplitude distortion in one trace. Am i reinventing the wheel here or just doing something useless?

4. i am using a sound card, and i do try to maximize the use of the 16 bits i have available by operating near full scale. when i am careful i can get near -85 dB (about 95 db is the theoretical limit for 16 bit?). i hope to get a 24 bit sound card soon so i can improve my measurement range.


thanks again.

okapi 8th November 2008 04:21 AM

shareware Farina
 
http://www.fesb.hr/~mateljan/arta/news.htm

it's not freeware but seems like a good deal.

farina method was implemented in the june 29th, 2007 update.

Pjotr 10th November 2008 05:38 PM

Re: shareware Farina
 
Quote:

Originally posted by okapi
http://www.fesb.hr/~mateljan/arta/news.htm

it's not freeware but seems like a good deal.
That is to say, you can use the program for free without limits. The only limitation is you can’t save data files. But you can transfer screenshots to the clip board from within the program.

The bundle also includes “STEPS” which is a separate program, that measures distortion with a stepped sine sweep.

;)

Pjotr 10th November 2008 05:48 PM

Quote:

Originally posted by bwaslo
...............................

If you're doing it with a soundcard, also be sure that you are operating near the full scale levels (that is, just below clipping) of both the playback (D/A) and record (A/D) converters. Else, you won't be able to get residual distortion of your test setup down very far -- you need to use all the bits of resolution your soundcard has available.
No all soundcards measures best just below full scale. My M-Audio Audiophile 2496 measures best at –10 dB full scale.

tritosine 12th November 2008 12:28 AM

delta sigma adc THD rises considerably as approaching theoretical max, well documtented behavior. Check the AKM5394 ( E-mu 1212m) ev-kit datasheet for example, -10 , -12 is on the safe side.

okapi 12th November 2008 01:46 AM

i will check THD as a function of gain for my test hardware experimentally.

can anyone recommend a good, $350 or less soundcard for this type of work? preferably one that can do square waves. i have seen this page which has instructions on how to mod the M-audio delta for decent square wave reproduction.

when reading the arta manual i was happy to see that the sound card protection circuit i came up with, with some help, was the same one implemented by arta. I also loop back one channel, as they do, to create my reference wave.

Iain McNeill 12th November 2008 03:13 AM

Yes, this is a key point. I always keep everything below -6dBFS for the aforementioned reasons and more. The reconstruction filters can clip even when the absolute value of the samples is less than full scale. This is because they are trying to recreate a sine wave between the discrete points and so the waveform can peak above the max sample before it starts back in the other direction. I see THD rising in all my DAC outputs above -10dBFS

I also use the ESS method described by Angelo Farina, a very elegant technique that can tolerate distortion unlike MLS. But for THD I fall back on taking FFTs at discrete frequencies. It allows you to get the pure THD as opposed to THD+N which can be deceptive.

Angelo Farina's method is excellent at visually representing the harmonic distortion components but when it comes to analyzing what's happening in a system at 834Hz, it's not too friendly. I have implemented both techniques in MATLAB and using ESS on a relative scale is great: A is obviously better than B but when it comes to absolute values I have as yet failed to correlate ESS to stepped sine FFT. My poor math skills.:(

If you have a good S/W package such as soundeasy, mlssa etc, then you can probably rely on their calibration but I haven't had the opportunity to evalulate these devices so can't comment.

edit: Angelo Farina's ESS method was, if I remember correctly, devised to provide the best impulse response measurement for large rooms and auditoria. Using long ESS sweeps (like 20-30secs because that's how long the decay is) you can get phenomenal signal to noise. I think it has a lot in common with Heysers seminal Time Delay Spectroscopy work.

okapi 12th November 2008 03:55 AM

Quote:

Originally posted by Iain McNeill
I have implemented both techniques in MATLAB and using ESS on a relative scale is great: A is obviously better than B but when it comes to absolute values I have as yet failed to correlate ESS to stepped sine FFT. My poor math skills.:(

would you mind posting your matlab code here for the Farina method. I plan to implement the same thing in IgorPro but i can almost guarantee my math skills are inferior to yours.

Here is a screenshot of the acquisition panel i have developed in igor. Analysis is running as well but it is not fully implemented at this time.


All times are GMT. The time now is 10:59 PM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 17.65%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Copyright ©1999-2020 diyAudio

Wiki