Measure harmonics: Hammerstein vs stepped tones

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I have been using plugindoctor::hammerstein to analyze harmonic content, but I've noticed that harmonic response is different from measuring tone by tone.
By "tone by tone" I mean sending tones at different frequencies and measuring the amplitude of each harmonic to finally draw a curve joining the different points in the spectrum.

obviously I am misunderstanding , since I was convinced that the result should coincide with "tone by tone" method.

Why do these give different results?
Thanks!

Post

Is your "tone" a pure sine wave?
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

How does the "hammerstein" method work? With an exponential sine sweep?

Post

BertKoor wrote: Tue Nov 30, 2021 7:32 am Is your "tone" a pure sine wave?
Yes
kippertoffee wrote: Tue Nov 30, 2021 12:43 pm How does the "hammerstein" method work? With an exponential sine sweep?
Yes, and from what I've seen, it has a length of 12 seconds.

Post

BertKoor wrote: Tue Nov 30, 2021 7:32 am Is your "tone" a pure sine wave?
I think I'm understanding what is happening. Being an exponential sweep sine, the low frequencies will have more predominance, so it will have more distortion.
Perhaps the correct way to analyze it is by sending a linear sweep sine.

Post

kippertoffee wrote: Tue Nov 30, 2021 12:43 pm How does the "hammerstein" method work? With an exponential sine sweep?
Based on quick search it seems that hammerstein is system model, where you model nonlinear system as sum(Gn(x^n)) where Gn is some linear filter. If plugindoctor displays these estimated filters, it is not the same as for example Farina's approach (where you have spectrum per harmonic), especially for higher order harmonics.

Post

plusfer wrote: Tue Nov 30, 2021 3:10 pm I think I'm understanding what is happening. Being an exponential sweep sine, the low frequencies will have more predominance, so it will have more distortion.
Perhaps the correct way to analyze it is by sending a linear sweep sine.
The Decorrelation process accounts for the additional time spent at low frequencies. If done properly. I did a bit of work with using exp sine sweeps for measuring nonlinearities and if done right it should come out with the same results as tonal analysis. But without actually knowing what's going on under the hood in plugindoctor it's hard to say more.

I don't think you can decorrelate the higher order "impulse responses" when using a linear sweep. It's one of the nice properties of a exponential sweep that you can do that.

Post

urosh wrote: Wed Dec 01, 2021 12:48 pm Based on quick search it seems that hammerstein is system model, where you model nonlinear system as sum(Gn(x^n)) where Gn is some linear filter. If plugindoctor displays these estimated filters, it is not the same as for example Farina's approach (where you have spectrum per harmonic), especially for higher order harmonics.
It's possible to extract the filters from sweep measurements. This references papers demonstrating how:

https://se.mathworks.com/matlabcentral/ ... in-toolbox

It does assume a certain model of nonlinearity though.

Post

kippertoffee wrote: Wed Dec 01, 2021 1:48 pm It's possible to extract the filters from sweep measurements.
It is extracted via sweep, but these filters are not the same as "harmonic spectrums". x^3 for sine input will contain first and third harmonic, estimated filter for this will not be the same as spectrum of third harmonic alone.

Post

Can someone please point me to some resources on how to read or interpret the Hammerstein visualization in PluginDoctor?
The manual does not really cover that topic at all. So I‘m not quite sure what I‘m looking at.

Googling it did not help a lot sadly, I’m just more confused about this.

As far as I understand we are looking at the harmonic content of a specific frequency, right?

Post

urosh wrote: Wed Dec 01, 2021 1:56 pm It is extracted via sweep, but these filters are not the same as "harmonic spectrums". x^3 for sine input will contain first and third harmonic, estimated filter for this will not be the same as spectrum of third harmonic alone.
I agree with you, I think we were just using different terms. The link I provided gives a method for separating the actual "harmonic spectrums" from the higher order sweep IRs. So separating out first and third, etc.

Post

Maybe to clarify this a bit: the peaks in a pure-tone harmonic analysis and in the Hammerstein graph are usually not the same. For instance, if you have a waveshaper like y = x + 0.1*x*x, in the Hammerstein graph you will see one contribution (flat over all frequencies) at 0 dB which comes from the "x" part, and one flat contribution at -20 dB that comes from 0.1*x*x (as you would expect it, because dB = 20*log10(volt)). In the Harmonic Analysis tab, you will see the two peaks, of course, but due to sin^2(x) = 1/2*(1 - cos(2*x)), the contribution at the 2nd harmonic will be at about -26 dB due to the "1/2" factor. You can use the excellent free FuncShaper by RS-MET (if you are on Windows) to experiment with different waveshaping functions and see what they do. It becomes even more complicated with higher terms, as there are contributions of the 2nd harmonic in the 4th harmonic, and so on.
Generally, Plugindoctor follows the approach shown at https://ant-novak.com/pages/sss/ very closely, for those who really want to dive into the mathematical details.

Post

docdued wrote: Fri Dec 03, 2021 4:33 pm Generally, Plugindoctor follows the approach shown at https://ant-novak.com/pages/sss/ very closely, for those who really want to dive into the mathematical details.
Unless I'm mistaken, this part of the example code from that link adjusts for the 2nd order harmonic amplitude effect you are describing - and for higher order examples as well...

Code: Select all

%% Estimation of filters Gm of Generalized Hammerstein model (Diagonal Volterra Kernels)
% Coefficients A of the transform between the Hm and Gm
A(N,N) = 0;
for n = 1:N
    for m = 1:N
        if ( (n>=m) && (mod(n+m,2)==0) )
            % Eq. (48) of [Novak et al. (2010)]
            A(n,m) = (((-1)^(2*n+(1-m)/2))/(2^(n-1)))*nchoosek(n,(n-m)/2) ;
        end
    end
end

% tranform the HHFR Hm to filters Gm
Gm = Hm/A;

Post

Oh no, just realised what a load of shit I'm talking :hihi:

Right you are!

Post Reply

Return to “DSP and Plugin Development”