# Beta Test: DISTORT - audibility of distortions

OP

#### pkane

##### Major Contributor
Forum Donor
Paul, if you take the simplest case, F1+F2 and a pure H2 distortion, and F1 and F2 are close to Fs/2, as in our case (19kHz, 20 kHz and Fs/2=24kHz), then we get only one distortion component, F2-F1 = 1kHz below Fs/2. Everything above Fs/2 is prohibited by Nyquist theorem, which says that input signal can be properly reconstructed from its samples if the signal frequency is <Fs/2. So the components 2F1, 2F2 that all lie above Fs/2 and are H2 product are prohibited and are normally removed by a brickwall filter tuned just below Fs/2. This is for H2.
H3 creates equally spaced skirts around F1 and F2 at 2F1-F2 and 2F2-F1 frequencies, i.e. at 18kHz and 21kHz. These products are OK. So the lines of even harmonic distortion we can see at the left side as multiples of 2 x (F2-F1), 2kHz as a product of H2, 3kHz of H4 etc. Same for skirts that are created by odd harmonic distortion components. But, we have set H2 to -60dB approx and H3 to -80dB approx, all else H4 etc. below -200dB, so we have only H2 and H3 distortion. We may see thus only the F2-F1 (1kHz) at -60dB and 2F1-F2 and 2F2-F1, i.e. 18 and 21kHz skirts at -80dB. There must be no 8-12kHz lines in the 16dB signal which has a noise bottom at about -132dB. Those lines would be somewhere at -200dB, thus invisible in this plot. This is very basic information and we who work with analog circuits know and are able to identify distortion components immediately. Your 8-12kHz lines are a product of calculation only.

Attached is a measured CCIF distortion of a tube amplifier with similar H2 and H3 as described above, plus a small H4. Attached is also a Burr Brown paper on IMD.

View attachment 45146
With ADC sampling 96kHz we may look to 48kHz but not higher.

http://www.ittc.ku.edu/~jstiles/622/handouts/Two-Tone Intermodulation.pdf
That's correct for an ADC. But DISTORT is simulating a DAC with the non-linear distortion being applied after the samples are converted, in effect, in the analog domain, with no post-filter, unless you select one in the settings.

Just searching around, here's a real world example posted here, on ASR, of measured IMD at the output of a DAC:

Look similar?

Last edited:

#### pma

##### Addicted to Fun and Learning
Paul, we want for the DISTORT to simulate properly behaviour of amplifiers etc. and to show audibility of non-linear distortion, not to show the DAC mirror images and audibility of NOS DAC errors. BTW, if the DAC uses oversampling and proper brickwall digital reconstruction, the mirror images disappear. Signal components created purely mathematically violate Nyquist and they contain components above Fs/2 which leads to mirrors and aliases.

Below is the proof, with your DISTORT. Increasing Fs and thus more distance of F1, F2 from Fs/2 helps a lot.
1) 19+20 kHz in 48/16 distorted by H2 and H3 as discussed yesterday, error is in red circle
2) 19+20 kHz in 96/16 distorted by H2 and H3, error is in red circle, and the error below 20kHz has completely disappeared, the only smaller error is near 2F1,2.

The plots below also explain why the 48/16 DISTORT product has had big errors for 19+20kHz distorted signal. The answer is simple, if you look at the 96/16 plot, there are distortion components between 36-40kHz (near 2F1, 2F2, H2 products) that are simply mirrored down to 8-12kHz components in the 48/16 plot. 48-40=8, 48-36=12, so 8-12kHz error lines. This is because your program calculates with those higher than 24kHz products in 48kHz sampling, which must necessarily lead to error mirror/alias components below Fs/2 (below 24kHz), that are not produced by the DUT non-linearity, but by the program. Sorry I am not able to explain it better.

Until this aliasing/mirroring error is fixed, the DISTORT will provide wrong results with music, especially for the signal components approaching Fs/2.

#### Attachments

• 329.7 KB Views: 12
• 328.8 KB Views: 7
Last edited:
OP

#### pkane

##### Major Contributor
Forum Donor
BTW, if the DAC uses oversampling and proper brickwall digital reconstruction, the mirror images disappear.
You can see the components that you say are incorrect, showing up in real-world captures, so something in the real world is violating theory I shared an example previously by someone else. This time, I just used my own DAC/ADC capture, with two filters in the path:

I'll dig in a little more to see why this is happening, but this happens even with large oversampling and brick-wall filter (above signal is generated at 384kHz and then sampled with a 48kHz ADC). Here's the same signal @384k sampled at 192k:

Generated @48k and sampled @48k:

Last edited:

#### 13th duke of Wymbourne

##### New Member
New user with basic problem.

Hi all, I am very excited to get to play with this software. On my first attempt I get a problem that it will not play/process my source file. Is this my set-up or a problem with the file? (files play fine in WMP)

TiA
13DoW

#### Attachments

• 206.5 KB Views: 8
OP

#### pkane

##### Major Contributor
Forum Donor
New user with basic problem.

Hi all, I am very excited to get to play with this software. On my first attempt I get a problem that it will not play/process my source file. Is this my set-up or a problem with the file? (files play fine in WMP)

TiA
13DoW
Hi 13DoW,

Download and install it, then try again. Hopefully this will resolve the error.

Regards,

-Paul

Last edited:

#### 13th duke of Wymbourne

##### New Member
Hi Paul, how can I save the post distorted file in the same resolution as the original file? The output files are 32 bit but my DAC will only handle 24bits. And I prefer the output sampling frequency to be the same, I am asked to resample.

TiA
13DoW

OP

#### pkane

##### Major Contributor
Forum Donor
Hi Paul, how can I save the post distorted file in the same resolution as the original file? The output files are 32 bit but my DAC will only handle 24bits. And I prefer the output sampling frequency to be the same, I am asked to resample.

TiA
13DoW
Hi 13DoW,

There's currently no way to prevent resizing to 32-bits floating point when saving as a WAV file. But the sampling rate should remain unchanged: DISTORT doesn't resample when saving. You can add dither, at say, 24 bits, which will compute the samples for 24-bit precision, but they will still be saved as 32-bit floating point numbers.

You may get a warning about resampling when playing back with an audio driver. Check the message, it is likely not changing sampling frequency but, instead, increasing bit size. If the frequency is being changed, that's because the driver told DISTORT that it doesn't support the rate of the original file, and prefers another sampling rate.

#### 13th duke of Wymbourne

##### New Member
So I tried some simple experiments adding second and third harmonic to some music files. I heard no difference with 1% 2HD and no difference with 0.5% 3HD. I did not got higher, instead I am going to try different levels of 7HD as higher harmonics are supposed to be more objectionable.
What I am curious about is whether 2HD can mask audible higher harmonics. I was intrigued by this article by Bob Katz (matering engineer) where he built an adjustable second harmonic distortion box and by dialing in a little 2HD he could make lesser sounding heddphone amps match his reference.

Until then, I agree with pma that Distort should brickwall filter out harmonics and intermodd that are more than Fs/2. I did a simple test adding 2HD to an 18kHz tone and the alias falls on 8kHz (for CD).

Question to pma - what spectrum analyzer software are you using? I use the one in audacity but your plots look much better.

Regards
13DoW

#### A800

##### Addicted to Fun and Learning
Honestly I think there is enough distortion on any audio already present.
Not to mention the whole signal chain until you hear something.
The ear drum also might add quite a bit of distortion also.
No need to add even more of it.

OP

#### pkane

##### Major Contributor
Forum Donor
So I tried some simple experiments adding second and third harmonic to some music files. I heard no difference with 1% 2HD and no difference with 0.5% 3HD. I did not got higher, instead I am going to try different levels of 7HD as higher harmonics are supposed to be more objectionable.
What I am curious about is whether 2HD can mask audible higher harmonics. I was intrigued by this article by Bob Katz (matering engineer) where he built an adjustable second harmonic distortion box and by dialing in a little 2HD he could make lesser sounding heddphone amps match his reference.

Until then, I agree with pma that Distort should brickwall filter out harmonics and intermodd that are more than Fs/2. I did a simple test adding 2HD to an 18kHz tone and the alias falls on 8kHz (for CD).

Question to pma - what spectrum analyzer software are you using? I use the one in audacity but your plots look much better.

Regards
13DoW
I've already implemented configurable oversampling as part of DISTORT app, including a brick-wall filter. This will need more work and testing before I release it, as I want this to be as fast as possible to allow for real-time comparisons. You should try the blind test @Archimago posted with various degrees of THD added into the mix to see how much you can or cannot hear. On casual listening, I found 1% THD to be just about the cutoff for me, where I could just start to identify the distortion signature. On more careful listening, I could do a lot better, but I'll withhold my results until Archimago's blind test is completed and the results published

Regards,

-Paul