DiAna (under construction)
Home
The development of DiAna, an acronym for Distortion Analyser, dates back to nineties. In those days spectrum analysers (or an 'AP') were expensice. So I wondered, whether it would be possible to do the same with a sound card together with appropriate software? In those days only a few sound cards were available and offered very limited capabilities. Nevertheless I started this project in the hope that I could compensate for these shortcomings by developing more elaborate software. BUT.........

I've suspended this project for the time being, because of lack of a decent sound card for accurate HD and IM measurements.
A Waveterminal X192 for example, even after extensive modifications, wasn't good enough.
(Too much Harmonic distortion at 20kHz as well as I.M. distortion between the channels due to stereo DACs and ADCs. Aargh!)
That was the status quo as of 2005 and further developments came to an halt during the next eight years.

In 2013 however, I stumbled on a few Lynx L22 sound cards on ebay, which were relative cheap. These cards are targeted at a professional market and are much better than any consumer product. So I resumed this project. As a result, their are currently two versions: one pro and one crippled demo version. The latter can be downloaded at www.data-odyssey.nl/diana/. The latest product version is 1.47.6. After unzipping (of course) the exe can be installed anywhere on your hard disk, as it is a so called 'portable application'. I recommend to put it in a separate directory where also an ini and data files will be saved. Note that DiAna doesn't pollute your registry or whatsoever.

At he moment, one important thing is still missing:  documentation and help files. But in case of any question, please don't hesitate to contact me.


What is DiAna?
Apart from just an acronym for Distortion Analyzer, is it yet another software tool for analyzing distortions in audio amplifiers? Yes and No. Yes, because it measures the THD and IMD spectrum as well as the frequency response just like many other software tools are capable of doing this. No, because it also can detect spectrum components, which are solely related to the fundamental frequency (i.e. harmonics), even if they are deeply burried in noise.

In addition, it also shows the residual, which is very convenient when, for example, optimizing the quiet current of a class B (or AB) output stage. A more unique feature is that it can measure harmonics far beyond the Nyquist frequency. Of course, this only makes sense if the ADC doesnít cut-off these harmonics. A SAR-ADC with a wide band front-end can do this, while common audio ADCís will rigorously cut-off anything above the Nyquist frequency.
A few hints to get started:

First, unzip the filer, of course,  and put it in a separate directory. Since DiAna is a "portable" application, you can put it anywhere on your disk. Then, for a loop-back test, wire the sound card accordingly. After the very first start-up, you will get an error message. It simply means that the ini file wasn't yet present, so don't worry. Just press OK or ESC to remove the message.
Next, click on the Distortion button. If every thing went well the program starts collecting data during 2.5 seconds (100 records). In the lower pane the input signal is displayed
When done the THD spectrum in the lower pane is shown, while in the upper pane the input signal and the so called residual is shown.
But maybe it didn't go that easy. During start-up for example, the first detected ASIO is selected. Suppose this one wasn't wired for loop-back at all,  then you don't get a signal, of course. In that case go to Preferences->Sound card and select the right sound card. Hereafter this one will be selected automatically.
To select another frequency, amplitude, spectrum or whatsoever, go to Preference->Distortion
Under de hood:
In order to use this tool, one should have a basic understanding of how DiAna works, in particular with respect to choosing the right record length. Instead of collecting and averaging the stream of input data in a single run, this data stream is subdivided over a number of records. In doing so, the effect of possible amplitude and offset drift will be minimized. The shorter the records size, the shorter the influence of drift. On the other hand however, each records should contain enough information to accurately determine amplitude, frequency, phase and offset of the fundamental. These variables are needed in the next averaging step. So each record should span at least say three cycles. Regarding the number of records, the more available, the better the suppression of noise and hum effects on the final THD spectrum. In general, a total measuring time of about 10 seconds will give satisfactory results.  After further analysis, the results  are displayed  graphically as well as numerical.

Averaging.
Input samples are mapped into a fixed interval, ranging from 0 to 2pi (by means of modulo 2pi arithmetic).
In order to make this stream of data manageable, this interval is subdivided in 1024 bins (actually an array 1024 x 80 bits) and each sample, after the fundamental has been subtracted (leaving only the residual), is accumulated in one of these bins. Clearly, the phase of a samples could have any value between 0 and 2pi, but since they are categorized in limited number (1024) of discrete values, giving rise to a sort of round off errors. How to deal with that will be discussed later on. After all data are collected, the residual is normalized by dividing the content of each bin by the numbers of samples stored in it. Bins might be empty, in which case these gaps are filled by means of interpolation, to be more precisely, by means of a periodic cubic spline.Gaps arise when the sampling frequency (fs) is a whole and relative small multiple of the signal frequency (fi), e.g. 192kHz respectively 4kHz. They seldom give rise to problems, but it is better to avoid them anyhow. In such case one should choose something like 3.999kHz or 4.001kHz.Now, we have the residual in its raw form. It should noted that the bandwidth of the residual is essentially not limited by the Nyquist frequency (fs/2) but the fundamental frequency times half the number of bins (fi x 512), unless the ADC is provided with an anti-alias filter as limiting factor (sound-card always has such filter).
Therefore, the spectrum at higher frequencies might look rather noisy and it is desirable to filter it out.
In order to subtract the fundamental, the exactly the amplitude, offset and phase of the fundamental have to been known. When the DAC and ADC are not synchronized or an external signal source is used, also the exact frequency has to be determined. in this case, select "External sync" to enable the frequency discrimator. In case DAC and ADC are synchronized, select "Internal sync". The latter mode is faster and less computation-intensive.

As these parameters slightly vary over time, averaging the data in a single run is not a good idea. Therefore, averaging is done over small chunks (records of say 4096 samples) and the results summed together.

Noise measurement.
Noise is measured by calculating THD+N first and then later on subtracting THD from it.
Although the THD measurement is extreme sensitive, as low as -300dB, it is not extreme accurate, only some 5 to 6 digits, mainly depending on the re-sampling and interpolating process. On the other hand, THD+N is calculated by subtracting a sine directly from the input samples without any further hassle (except low-pass filtering).Obviously, subtracting THD from THD+N will not give the exact answer. In case the actual noise is zero or far below the THD level, even a negative figure can result (you can check this by simulation: negative noise is indicated by an trailing * (e.g. -187dB*).Regarding real life signals, the noise level is probably of the same order as THD and the 'gross' inaccuracy, as outlined above, is completely masked.The noise bandwidth has to be specified, of course, otherwise the measurement is meaningless. The bandwidth can be specified in the Distortion Preference Menu: in Hz or A, B or C-weighting. If none is specified (i.e. zero), the bandwidth is limited to the Nyquist frequency.
One more important thing: The right mouse button is your best friend, as a lot more pop-up menus can invoked with this button.
To switch between different kinds of spectra, THD, Raw, etc.:  Click with the right mouse button on the lower pane.
To switch between Relative Spectrum and Absolute Spectrum: Click with the right mouse button on the lower left border.
When the small square at the lower left corner lights up, orange for warning, red for error, right click on this square to see what's wrong. In this example the CPU was for 16% busy with other things, which DiAna doesn't like. Left click on this square to clear the message. Also, there are a lot of keyboard short cuts. This will be covered later in more detail.
More on DiAna after the holidays.

Additional information can be found here:
http://www.diyaudio.com/forums/equipment-and-tools/315785-diana-software-distortion-analyzer-post5266519.html

Virus:
Please, be aware that some anti virus scanners will identify DiAna as dangerous. This is a 'false positive'. In this case, upload the file to virustotal.com, which scans the file with more than sixty different AV scanners. Perhaps a few of them have minor issues with DiAna. Just ignore them. Remember, no software is 100% perfect and that also applies to  AV scanners.
Right click on the lower pane
Right click on the lower left border
Right click on the error/warning square

Free website hit counter