If it still fails I'd try and simplify things a bit... if you have a massive buffer already, why not just write into it directly - for example:
var clipSeconds = 3;
var w = new Waveform(512*clipSeconds,{bits:16});
w.on("finish", function(buf) {
var a = buf;
E.FFT(a);
var m=0,n=-1;
for (var i=150;i<250;i++)if(a[i]>n)n=a[m=i];
console.log(m.toFixed(0)+"Hz @ "+n);
});
w.startInput(D2,512);
It is possible that the buffer size is too large for E.FFT, but there are checks in place to avoid that kind of problem and to throw an error if there isn't enough memory available.
Failing that, is there a reason you don't want to perform the FFT in smaller chunks and average the result?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Are you using the up to date (1v92) firmware?
If it still fails I'd try and simplify things a bit... if you have a massive buffer already, why not just write into it directly - for example:
It is possible that the buffer size is too large for
E.FFT
, but there are checks in place to avoid that kind of problem and to throw an error if there isn't enough memory available.Failing that, is there a reason you don't want to perform the FFT in smaller chunks and average the result?