• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Harmonic and Intermodulation Distortion

danadam

Addicted to Fun and Learning
Joined
Jan 20, 2017
Messages
956
Likes
1,496
Somehow the first post in this thread, on harmonic distortion, disappeared through the magic of moving the thread around. I have added it to the first post so the title is now correct (Harmonic and Intermodulation Distortion).
Btw this is Don being “super polite” and not blaming the proper culprit for the muck up. It was my faulty editing, “Magic” that made things disappear. Sorry Don! :oops:
Ah, that explains this still a bit confusing "A previous post discussed harmonic distortion ..."
 

pozz

Слава Україні
Forum Donor
Editor
Joined
May 21, 2019
Messages
4,036
Likes
6,827
Yet difference tones happen only in our hearing. You won't see them in a recording (unless the microphone also has IMD like our ears).
So I whipped open the book Physics & Psychophysics of Music by Juan Roederer.

@dc655321 was right. Beats are a linear phenomenon involving the instrument, eardrum and basilar membrane, which move in unison. The ear picks up the resulting envelope. They only happen when the frequency difference is very low.

Combination tones (sum or differences tones) on the other hand are not present at the eardrum, or even at the entrance to the cochlea, the oval window, and happen down the line. This is the nonlinearity of the inner ear in action. Roederer cites this article, where the speculation is that the tones result due to separate cochlear mechanisms being activated at the same time.

Difference tones occur acoustically but only at very low levels. There's an experiment out there with dog whistles that demonstrates that.
 

pma

Major Contributor
Joined
Feb 23, 2019
Messages
4,591
Likes
10,727
Location
Prague
Yet difference tones happen only in our hearing. You won't see them in a recording (unless the microphone also has IMD like our ears).

Speakers produce them as well and sometimes at considerably high level.
 

MRC01

Major Contributor
Joined
Feb 5, 2019
Messages
3,424
Likes
4,030
Location
Pacific Northwest
Sure, because speakers also produce HD; as I understand it, both HD and IM are artifacts of the same non-linearity.
 

pma

Major Contributor
Joined
Feb 23, 2019
Messages
4,591
Likes
10,727
Location
Prague
Sure, because speakers also produce HD; as I understand it, both HD and IM are artifacts of the same non-linearity.

Yes, but most of you are talking about "static" nonlinearity, i.e. the nonlinearity that is independent of frequency. In case that nonlinearity depends not only on level, but also on frequency (almost always the case), there is no simple single equation (like polynomial nonlinearity) and you are unable to predict IMD from a single HD measurement.
 

MRC01

Major Contributor
Joined
Feb 5, 2019
Messages
3,424
Likes
4,030
Location
Pacific Northwest
Is that because the transfer function for a speaker is different from the transfer function for an amplifier? If you knew the transfer function for a particular speaker, you should be able to derive HD and IM from it, right?
 
OP
DonH56

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,835
Likes
16,497
Location
Monument, CO
Speakers and amplifiers have limited bandwidth and the distortion also varies with signal level. Every one will be a little different. The basic equations posted don't care, but as @pma said are at a single point. Measuring the speaker's transfer function can be daunting, and you have to decide what to include. For instance, it changes as the voice coils heat, can be influenced by air temperature and density, mechanical changes (usually inaudible after the first few seconds), etc. And of course you have to determine how much the measuring system (e.g. microphone, preamp, ADC) contributes to the distortion.

If you know the transfer function completely, including how it varies over all parameters, then you can predict HD and IMD. In general we can get close enough, though it is easier with electronics than speakers IME/IMO.

I have lost track of where all this is going... The original posts were to provide some insight into basic (to avoid the word "rudimentary") distortion and to show how IMD can be derived from HD in the theoretical world. The practice matches the theory for many cases, but delving into all causes and how it changes over various parameters like signal level and bandwidth is beyond the scope of what I presented here. Most (probably all) of my articles are simplifications meant to give those with a basic math background some insight into some of the terms and specs thrown around in the audio world. Going deeper requires more than a few posts and usually leaves the readers behind.
 

pozz

Слава Україні
Forum Donor
Editor
Joined
May 21, 2019
Messages
4,036
Likes
6,827
Heerens & DeRu physical theory of hearing, for IMD induced beating experiments got to page 66.
Note the remarks for Example 3.8.0 and following.
You know their work hasn't been accepted?

I was very interested when I read it, and I'd like to see some of the claims directly addressed. Especially explanations for their demonstrations. I have some observational comments, though, which make me doubt their approach and conclusions.
The travelling wave on the basilar membrane has been measured, for example, using laser interferometry. Perhaps they don't agree that what is observed is a travelling wave, but they don't go into detail responding to that data.

They barely comment on active vs. passive processes in hearing, or the role of motility in outer hair cells (besides criticizing some of the explanations), which is a unique anatomical feature of the hearing system vs. other senses. Frequency selectivity depends on it. They mention the muscles in the middle ear as the real cause of amplification, but don't go into detail. This, despite the main lit stating that the function is inhibitory.

Their explanation for the perception of infrasound doesn't fit experimental data. Below 15Hz tone perception collapses. Below 10Hz subjects detected individual pressure maxima but not the cycle. The lower limit of hearing does not have a distinct threshold. I had put together this chart previously:
index.php


Overall, I'd agree that the foundational experiments for ear mechanics should be questioned. This is in part because it's been impossible to make measurements on living humans, and the measurements made on animals, especially the intrusive measurements in vivo, damage the very organ they are supposed to be studying. Same criticism goes for using knockout animals to stunt the development of certain anatomy or functions as a sort of negative proof of role.

Definitely lots more work to be done for hearing science in general, and these two authors in particular.
 

pma

Major Contributor
Joined
Feb 23, 2019
Messages
4,591
Likes
10,727
Location
Prague
Is that because the transfer function for a speaker is different from the transfer function for an amplifier? If you knew the transfer function for a particular speaker, you should be able to derive HD and IM from it, right?

It is nice to say, but please show me mathematically relevant transfer function of the speaker with all variables - level, frequency and time. Wolfgang Klippel is near. As you know, there are many nonlinearities in the driver (speaker) that evolve after seconds or tens of seconds of signal excitation. This is all but simple. Together with resonances. Amplifiers, compared to this, are more simple to be described and simulated, still the simulation is not perfect, though very good. Nonlinear functions of the real thing are complex (difficult to describe). Add hysteresis and you have the real world. I understand the effort to stick with secondary school math or college equations, but, it is not enough. It is enough to make basic explanations to newcomers, not enough to cover the issue.
 
OP
DonH56

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,835
Likes
16,497
Location
Monument, CO
This thread was never intended to make amplifier designers (or testers) by just reading a couple of posts on the Internet. Would it were true; could've saved me many years of learning. Maybe I'm just slow...
 

KSTR

Major Contributor
Joined
Sep 6, 2018
Messages
2,690
Likes
6,013
Location
Berlin, Germany
You know their work hasn't been accepted?
As far as I know, no, they struggled with peer review and still do though I don't know if they kept trying.

I agree that there certainly are weak spots in their work that need more thorough work. Then again, if we just see strictly as a behavioral model, not necessarily reflecting what's really going one here, it should suffice to show that the listening experiments are in agreement to the predictions from the model, examining the IMD products, shouldn't it. @MRC01's recorder flute ensemble seems to fit perfectly as well (and as child I made the same experience when recorder flute was the instrument in vogue at schools to introduce kids to making music together).

One can download a generator software for Windows to recreate the experiments, which I did. Because the algorithm is easy those multitones also can be set up from scratch in an audio editor or even some C/Python/Matlab/... code, then used in ABX if one needs that confidence level in the listening tests, or run them through a distortion mechanism equal to the one claimed by the authors and look at the spectra, etc.
 

pozz

Слава Україні
Forum Donor
Editor
Joined
May 21, 2019
Messages
4,036
Likes
6,827
As far as I know, no, they struggled with peer review and still do though I don't know if they kept trying.

I agree that there certainly are weak spots in their work that need more thorough work. Then again, if we just see strictly as a behavioral model, not necessarily reflecting what's really going one here, it should suffice to show that the listening experiments are in agreement to the predictions from the model, examining the IMD products, shouldn't it. @MRC01's recorder flute ensemble seems to fit perfectly as well (and as child I made the same experience when recorder flute was the instrument in vogue at schools to introduce kids to making music together).

One can download a generator software for Windows to recreate the experiments, which I did. Because the algorithm is easy those multitones also can be set up from scratch in an audio editor or even some C/Python/Matlab/... code, then used in ABX if one needs that confidence level in the listening tests, or run them through a distortion mechanism equal to the one claimed by the authors and look at the spectra, etc.
I tried their listening experiments. They work well, I'm just not sure why their explanation (over and above that of others) is the correct one. This chart, in Roederer's book (and Roederer is a physicist by training first), integrates several phenomena:
Critical_Band2.gif

It situates beats as being specifically within one critical band, while ear related IMD happens off-chart when the difference between stimuli is beyond a critical band. IIRC he based it on psychoacoustic findings.
 

danadam

Addicted to Fun and Learning
Joined
Jan 20, 2017
Messages
956
Likes
1,496
If anyone is interested, here are 10 second samples of the examples from the article:
Code:
]$ ls -1 hd_and_imd
01_1k.flac
02_1k_hd2_20dB.flac
03_1k_hd3_20dB.flac
04_1k_hd2_40dB.flac
05_1k_hd3_40dB.flac
06_1k_hd2_60dB.flac
07_1k_hd3_60dB.flac
08_523_661.flac
09_523_661_imd_20dB.flac
10_523_661_imd_40dB.flac
11_523_661_imd_60dB.flac
I used sox. For the harmonic distortion examples I simply created 1k, 2k and 3k tones and mixed them together as needed. For the intermodulation distortion, I've learnt that sox has "-T" option for multiplying inputs, so then I could use the formula from the post:
Vout = Vin + HD2*Vin^2 + HD3*Vin^3.
The dB values in the imd filenames is the value used for HD2 and HD3 in that formula.
And fft's for the 40dB samples:
04_1k_hd2_40dB.png

05_1k_hd3_40dB.png

10_523_661_imd_40dB.png
 

Attachments

  • hd_and_imd.zip
    2.7 MB · Views: 106

KSTR

Major Contributor
Joined
Sep 6, 2018
Messages
2,690
Likes
6,013
Location
Berlin, Germany
Nice work, thanks for sharing... though I find that 10secs is a bit short sometimes. Maybe you could include the generating command lines so users could adapt output duration?

Short snippets that can be looped seamlessly are the best solution but that requires each component to fit exactly into the sequence length with an integer number of periods. That's hard to to with SoX or the like, that's why I did in C. I only have "rough" code I could share (no sophisticated command line parametrization and it simply outputs an array of double that you need to convert to WAV or whatever externally).
 

danadam

Addicted to Fun and Learning
Joined
Jan 20, 2017
Messages
956
Likes
1,496
Maybe you could include the generating command lines so users could adapt output duration?
Something like this:
Code:
length=10
level=-40

# HD
sox -r44.1k -n -b16 1k.wav synth ${length} sin 1k norm -0.5
sox -r44.1k -n -b16 hd2.wav synth ${length} sin 2k norm -0.5 gain ${level}
sox -r44.1k -n -b16 hd3.wav synth ${length} sin 3k norm -0.5 gain ${level}

sox -m -v1 1k.wav hd2.wav 1k_hd2.wav
sox -m -v1 1k.wav hd3.wav 1k_hd3.wav

# IMD
sox -r44.1k -n -b16 signal.wav synth ${length} sin 523 sin 661 remix - norm -1.3
sox -T signal.wav signal.wav signal2.wav gain ${level}
sox -T signal.wav signal.wav signal.wav signal3.wav gain ${level}

sox -m -v1 signal.wav signal2.wav signal3.wav signal_imd.wav
 

bigjacko

Addicted to Fun and Learning
Joined
Sep 18, 2019
Messages
721
Likes
359
I have questions about drivers distortion. We alreadu know that THD and IMD is a certain ratio which is build into the math. Is it only electronics or it also covers mechanical device like drivers? I can sometimes find driver comparisons that a driver has lower THD but higher IMD compare to another driver. If we assume all the parameters of the driver that controls distortion are the same, for example Bl(x), Kms(x) Le(x) and Le(I) are the same, then will IMD follow THD in a certain ratio? Thank you for any input.:)
 

MRC01

Major Contributor
Joined
Feb 5, 2019
Messages
3,424
Likes
4,030
Location
Pacific Northwest
I have questions about drivers distortion. We alreadu know that THD and IMD is a certain ratio which is build into the math. Is it only electronics or it also covers mechanical device like drivers? I can sometimes find driver comparisons that a driver has lower THD but higher IMD compare to another driver. If we assume all the parameters of the driver that controls distortion are the same, for example Bl(x), Kms(x) Le(x) and Le(I) are the same, then will IMD follow THD in a certain ratio? Thank you for any input.:)
HD and IMD are different aspects of the same non-linearities. Their relationship is derived from the transfer function of the device in question. And drivers would have different transfer functions from amplifiers. @pma said above that the transfer function for drivers would be much more complex in order to be accurate enough to be useful.
So the answer to your question: "yes" in theory, but "no" in practice because the transfer function would be so complex it would be infeasible to derive it.
So rather than attempt to predict the HD and IMD theoretically, we can take an easier approach: measure the HD and IMD that the device (speaker) actually produces.
 
Top Bottom