Audio icon indicating copy to clipboard operation
Audio copied to clipboard

update to analyze_notefreq

Open duff2013 opened this issue 9 years ago • 0 comments

The current Yin algorithm does a poor man's decimation without any FIR (LOW-PASS) filtering of the signal for aliasing. The decimation is a must because this algorithm is to cycle costly at 44.1KHz and the way I choose to do the current objects decimation was in the inner loop when finding the sum of squared differences. While this works ok I decided to rewrite a proper algorithm using CMSIS fir-decimation of the input signal. By decimating by factor of 2 gave max cpu usage of only 50% when a to low frequency or no signal is feed into it (Teensy 3.2 96MHz). Now the dilemma ...

Since the FIR filter part of the CMSIS decimation is identical to the FIR Audio Object, I changed the "begin" function to add the parameters filter coefficients, number of taps and decimation factor. I wondered though if it would be better to just to have preset of coefficients for 2,4,8 decimation factors in the library itself? This way novice users can just use it without getting into the weeds with modeling the best coefficients, but then I thought for more advanced users we could provide an another "begin" function for inputing their own filter coefficients.

Here is the updated library and I updated the example too. This version doesn't include the coefficients in the library itself the user has to provide this so this would be for more advanced users.

I understand this won't apply to 1.31 release but what do you think?

duff2013 avatar Nov 08 '16 19:11 duff2013