[sdiy] Measuring Audio Sine Purity
Scott Gravenhorst
music.maker at gte.net
Sat Sep 15 17:53:16 CEST 2012
First, thank you all for your responses, I will respond to specific
statements inline, but again, thank you to all who responded, all
of this was good information.
>-------------------------------------------------------------------------------
>From: John Speth <jspeth at avnera.com>
>
>> How would a DIY person measure the purity of a sine wave beyond using a
>> spectrum analyzer? To give a figure of sine purity, of distortion
>(THD?) ?
>
>The pros use Audio Precision tools which are considered to be the standard
>for THD measurement devices. The AP boxes are outboard to the PC.
>They're connected digitally to the PC eliminating the audio inaccuracies
>introduced by the PC. My guess is that if PC sound cards were comparable
>to the AP boxes in audio quality, the AP boxes wouldn't be needed.
>
>You might find PC sound card analysis software but I'd be concerned about
>the accuracy at the low levels of THD that you probably want to measure.
>
>JJS
Agreed, and that (PC sound card effective accuracy) was one of the issues.
The project I was doing was for a another party and they wanted "numbers"
for comparison of various methods.
>-------------------------------------------------------------------------------
>From: "Jerry Gray-Eskue" <jerryge at cableone.net>
>
>There is a lot of info on the web if you look for Measure THD, here is one
>on how to use the spectrum analyzer to calculate THD and more.
>
>http://dogstar.dantimax.dk/tubestuf/thdconv.htm
Quite interesting, thank you.
>-------------------------------------------------------------------------------
>
>From: "Paul Perry" <pfperry at melbpc.org.au>
>
>I'm not sure that THD is always the most appropriate measure, when it comes
>to judging a DIY synth sine wave.
>For example, I have made saw to sine converters that sounded pretty good,
>and doubtless would have measured resonably well - but had spikes at the
>crossover points that were pretty unfortunate at very low frequencies, when
>using the sine as a modulator.
>
>All I can suggest, is that since the distortion artifacts are always going
>to be multiples of the fundamental frequency, you might get some indication
>by building a band pass filter set at say 1KHz, and seeing what came through
>as you tuned the oscillator to submultiples - 500Hz, 333.3, 250 etc.
>
>paul perry Melbourne Australia
Thanks, I'm beginning to realize what a snake pit this whole thing has become.
>-------------------------------------------------------------------------------
>
>From: ASSI <Stromeko at nexgo.de>
>
>THD isn't well defined, see
>
>https://en.wikipedia.org/wiki/Total_harmonic_distortion
>
>for competing definitions. What you get from analyzing a WAV file is an
>amplitude spectrum, so some definitions are easier for this than others.
>
>What level of THD are you targeting? Each measurement system would bring
>its own THD which effectively gives you the lowest THD that you can
>practically measure (or, if you're not careful enough, you'd attribute the
>THD of the measurement system to the source). You would actually always
>measure THD+N anyway, but that's another story.
>
>http://www.bksv.com/doc/BO0385.pdf
>
>> Say you have an oscillator you built, it's supposed to be a sine
>> oscillator and you'd like to know just how pure it is. What would you
>> use?
>
>Well, going all digital is the coup du jour. But analog is still thereâ¦
>
>That would be wildly inaccurate if implemented naively like that, so you
>need to analyze where those errors are and pull a few tricks to get them out
>of the equation. Like what Bill Hewlett and Dave Packard did in 1941: "The
>300A measured the individual harmonic present in the output voltage of an
>amplifier. It consisted of a balanced detector, a local oscillator and a
>tuned amplifier."
>
>http://www.national.com/AU/design/courses/247/247_audio_amplifier_measurements.pdf
>https://en.wikipedia.org/wiki/THD_analyzer
>
>> I've used RMAA to analyze a wav file of a sine signal, but that doesn't
>> give purity numbers, it just gives the spectrum.
>
>RMAA should be able to calculate THD+N figures since version 6.2.3.
Yes, unfortunately, 6.2.3 would not run on either of my XP machines. In fact,
I began this by using RMAA ver 5.5 to simply look at the spectrum, but this wasn't
giving the results I expected. I had started by testing the card (Turtle Beach
Riviera) in loopback mode (internal, I could not get it to do an external loopback).
The loopback said that the sound card had a fair noise floor (-96 dB) and nice flat
response. However, there was apparently something fubar with a preamp from line-in
because no matter what I put into it, the spectrum had all kinds of trash that
was obviously not harmonic to the fundamental I was trying to analyze. Eventually,
I did the same test with a Real Tek system which gave crap results in terms of
noise floor and spectral flatness, but it did confirm that the spectral hash was
coming from the Turtle Beach. I ultimately had to tell my friend that I couldn't
deliver any truly meaningful results.
>> Is there software that might be used with a good sound card?
>> (understanding, of course, that soundcard artifacts will present
>> themselves in the results)
>
>That problem has been pondered and solved many times over. I'd still
>recommend an external sound card if you care about an absolute measurement,
>but if you just want to know "good" from "better", then internal is OK.
>
>http://www.artalabs.hr/news.htm
>http://www.ymec.com/hp/signal2/thd.htm
>http://www.purebits.com/appnote8.html
>
>> I imagine that there is expensive hardware, but that's out of the question
>> for me.
>
>A little bit of imagination goes a long way of saving the expenses. For the
>rest of us we thankfully have search engines. :-)
>
>
>Regards,
>Achim.
>-------------------------------------------------------------------------------
>
>From: Richie Burnett <rburnett at richieburnett.co.uk>
>
>How is your candidate sinewave being generated? If it is generated digitally in
>software, then one option is to capture the output buffer using emulator or
>debugger tools then save the data to disk for analysing.
Different methods, both analog and digital. The idea was to get a highly pure
sine that could then be used to test different DACs at different sine frequencies.
>You can then load up the waveform data into Excel and calculate your desired
>distortion metrics. For instance you could perform an FFT and generate a THD
>figure from this. Another method is to compare your waveform with a numerically
>perfect sinewave generated by Excel, and examine the difference that remains
>after subtracting one from the other.
I got as much from RMAA ver 5.5, but as I mentioned, the Real Tek I was forced
to use was contributing enough crap that those results were largely invalid.
>Of course this technique removes the need for any digital to analogue conversion,
>and analogue to digital conversion. So they dont take into account any THD or
>noise that would be introduced during these processes.
>
>Its useful for proving the bottom- line distortion figure for a particular
>implementation of a sinewave algorithm in the digital domain though. Any
>programming errors should easily be apparent. And if the sinewave is pure at this
>point, then any distortion present in the analogue output must have been
>introduced by the DAC step or subsequent analogue processing.
>
>-Richie,
>
>-------------------------------------------------------------------------------
>
>From: Neil Johnson <neil.johnson97 at ntlworld.com>
>
>Hi Scott,
>
>The answer really depends on how much you care about detail. What
>level of distortion are you looking for?
Heh, well, is low as could be obtained, but it seems the equipment I was forced
to use precluded an measurement I'd call "accurate".
>Here is a superb example of a DIY audio analyser:
>
>http://www.users.on.net/~glenk/thd/thd.htm
>
>You can also read about the Cordell analyser which predates the above
>project and you can still download the articles describing it.
>
>Or, as I did, buy an HP 8903B audio analyser which is rather easier to use :)
>
>The trouble with using a PC card, or USB scope, or any other type of
>scope, even a spectrum analyser, is that you're hitting the input with
>both the fundamental signal and the distortion and noise. So you're
>relying on the dynamic range of the equipment alone. A notch filter
>removes the fundamental leaving only the harmonics and noise, which
>you can then amplify if needed before feeding into your test
>equipment. That way you get the full benefit of the instrument's
>dynamic range to make meaningful measurements.
>
>For example, suppose you have a sinewave oscillator that puts out a 5V
>peak-peak signal. And lets say you're using one of those PicoScope
>USB pods, with 8-bit converters (2000-series or 3000-series). So you
>set the input attenuator to the 5V range to avoid overloading the
>input amplifier. That gives you an LSB of 5/256 = 19.5mV. Any noise
>below that you just won't see. In other words your dynamic range is
>48dB, or a THD of about 0.4%. With a notch filter you can remove the
>fundamental and turn up the gain of the scope input and get much
>better analysis of the residual.
>
>An audio analyser has both a notch filter and a sensitive AC RMS
>voltmeter, which is exactly what you need. For really detailed
>measurements you need a very deep notch (>90dB), which can be done in
>various ways, e.g., state variable filter, twin-T, bridged-T, etc. One
>nice thing the 8903B does is once it has locked onto the fundamental
>it autotunes the notch filter, servoing out any small changes in the
>behaviour of the notch filter (thermal drift mostly).
>
>There is a good write-up here: http://www.moorepage.net/THD.html
>
>Cheers,
>Neil
>-------------------------------------------------------------------------------
>
>From: Justin Owen <juzowen at gmail.com>
>
>I got some good info on this when I asked about it earlier this year.
>
>Search here: http://search.retrosynth.com/synth-diy/
>
>...for the subject "Better testing techiques for audio circuits"
>
>Yes, apparently I spelt 'techniques' wrong :)
>
Heh, and now I will have to go there to read too.
Thanks again to all!
-- ScottG
________________________________________________________________________
-- Scott Gravenhorst
-- FPGA MIDI Synth Info: jovianpyx.dyndns.org:8080/public/FPGA_synth/
-- FatMan Mods Etc.: jovianpyx.dyndns.org:8080/public/fatman/
-- Some Random Electronics Bits: jovianpyx.dyndns.org:8080/public/electronics/
-- When the going gets tough, the tough use the command line.
More information about the Synth-diy
mailing list