diff --git a/lib/hooks/dft.cpp b/lib/hooks/dft.cpp index 08dde4586..82a052835 100644 --- a/lib/hooks/dft.cpp +++ b/lib/hooks/dft.cpp @@ -779,6 +779,15 @@ public: { assert(state == State::PARSED); + if (!freqEstimateTypeC) { + logger->info("No Frequency estimation type given, assume no none"); + freqEstType = FreqEstimationType::NONE; + } + else if (strcmp(freqEstimateTypeC, "quadratic") == 0) + freqEstType = FreqEstimationType::QUADRATIC; + + + if (endFreqency < 0 || endFreqency > sampleRate) throw RuntimeError("End frequency must be smaller than sampleRate {}", sampleRate); @@ -1142,6 +1151,48 @@ static HookPlugininfo("y3 - y1 {} ; y_max : {}", (y3 - y1), maxBinEst); + + maxBinEst = (double)maxFBin + maxBinEst; + + /*Jain’s Method + if (y1 > y3) + { + y_max = (double)maxFBin - 1 + (((y2 / y1) / ( 1 + (y2/y1)))); + } + else + { + y_max = (double)maxFBin + ((y3 / y2) / ( 1 + (y3 / y2))); + }*/ + + y_Fmax = startFreqency + maxBinEst * frequencyResolution; + + Point ret = {y_Fmax, 0}; + + return ret; + } }; /* Register hook */