THD measurement - how to? - diyAudio
Go Back   Home > Forums > General Interest > Everything Else

Everything Else Anything related to audio / video / electronics etc) BUT remember- we have many new forums where your thread may now fit! .... Parts, Equipment & Tools, Construction Tips, Software Tools......

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 8th November 2008, 02:56 AM   #1
okapi is offline okapi  United States
diyAudio Member
 
okapi's Avatar
 
Join Date: Aug 2004
Location: Buffalo
Default 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:Click the image to open in full size.

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?
  Reply With Quote
Old 8th November 2008, 04:09 AM   #2
bwaslo is offline bwaslo  United States
diyAudio Member
 
bwaslo's Avatar
 
Join Date: May 2006
Location: Portland, Oregon!
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.
  Reply With Quote
Old 8th November 2008, 04:48 AM   #3
okapi is offline okapi  United States
diyAudio Member
 
okapi's Avatar
 
Join Date: Aug 2004
Location: Buffalo
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.
  Reply With Quote
Old 8th November 2008, 05:21 AM   #4
okapi is offline okapi  United States
diyAudio Member
 
okapi's Avatar
 
Join Date: Aug 2004
Location: Buffalo
Default 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.
  Reply With Quote
Old 10th November 2008, 06:38 PM   #5
diyAudio Member
 
Pjotr's Avatar
 
Join Date: Nov 2002
Location: Netherlands
Default 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.

  Reply With Quote
Old 10th November 2008, 06:48 PM   #6
diyAudio Member
 
Pjotr's Avatar
 
Join Date: Nov 2002
Location: Netherlands
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.
  Reply With Quote
Old 12th November 2008, 01:28 AM   #7
diyAudio Member
 
Join Date: Aug 2008
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.
  Reply With Quote
Old 12th November 2008, 02:46 AM   #8
okapi is offline okapi  United States
diyAudio Member
 
okapi's Avatar
 
Join Date: Aug 2004
Location: Buffalo
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.
  Reply With Quote
Old 12th November 2008, 04:13 AM   #9
diyAudio Moderator Emeritus
 
Iain McNeill's Avatar
 
Join Date: Oct 2007
Location: Santa Cruz, California
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.
  Reply With Quote
Old 12th November 2008, 04:55 AM   #10
okapi is offline okapi  United States
diyAudio Member
 
okapi's Avatar
 
Join Date: Aug 2004
Location: Buffalo
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.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PC Dac Measurement supra Digital Line Level 1 14th July 2009 01:54 PM
non os measurement Bernhard Digital Source 3 13th September 2006 10:12 PM
how to take db measurement sonu Multi-Way 7 9th May 2005 04:03 PM
New measurement mic in UK pinkmouse Multi-Way 4 10th February 2005 06:46 AM


New To Site? Need Help?

All times are GMT. The time now is 02:11 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2