I don't know exactly, no. You'd have to do some research - it's all standard FFT stuff.
I'm not convinced by your averaging at all, but hey, if it works for you...
If you really want a better result, average the entire array after the FFT, and do your calculations on that. If you know you have one single frequency then you can even get a more accurate idea of the frequency by looking at the relative size of the FFT peaks, eg:
// exactly that frequency
// halfway between two frequencies
// nearer the first frequency than the next one
© Espruino, powered by microcosm.
Report a problem