Open VolodymyrTymets opened 7 years ago
I'm also getting that error:
node_modules/fft-js/src/complex.js:24
return [(a[0] * b[0] - a[1] * b[1]),
^
TypeError: Cannot read property '0' of undefined
Source code (works if n==8, but not if n==10):
const fft=require("fft-js");
let input=[];
let n=10;
for(let m=0; m<n; m++) {
input.push(Math.sin(m*2*Math.PI/n));
}
let phasors=fft.fft(input);
console.log(input);
console.log(phasors);
I also get this, and I am first converting the Buffer to an Array, via Array.prototype.slice.call(buffer,0)
which makes an array of 1.5 million integers.
oh, fft only takes arrays that are a power of two of length.
I need get frequencies of .wav file. I can read file via fs
Exception
Is this possible to get phasors from Buffer? Or exist another way to get phasors from .wav file?