Tue 27 Aug 00:14:56 CEST 2024

This commit is contained in:
sbosse 2024-08-27 00:15:36 +02:00
parent 6d5ccb91b9
commit df36b1d3d6

15
test/test-fft.js Normal file
View File

@ -0,0 +1,15 @@
var FFT = numerics.fft;
var signal = [1,0,1,0];
var phasors = FFT.fft(signal);
log(phasors);
var frequencies = FFT.fftFreq(phasors, 8000), // Sample rate and coef is just used for length, and frequency step
magnitudes = FFT.fftMag(phasors);
var both = frequencies.map(function (f, ix) {
return {frequency: f, magnitude: magnitudes[ix]};
});
log(inspect(both));