Applies a windowing function to an array of data, making it ready to be FFT'd.
npm install fft-windowing-tsfft-windowing-ts is a node.js module that applies a windowing function to an array of data, making it ready to be FFT'd.
This package is a fork of Richard Eoin
This article by National Instruments gives a good introduction to why windowing functions are useful.
If you have npm installed, just run:
```
yarn add fft-windowing
The Hann (Hanning) window is a good general-purpose window. You would use it like so:
`javascript
import { hann } from "fft-windowing-ts";
const raw = [2, 2, 0, -2, -2, 0, 2, 2];
const windowed = hann(raw);
`
The resulting windowed variable is then ready to be fed through a Fast Fourier Transform. A good node.js module to use would be this one.
The following windows are available:
- hann
- hamming
- cosine
- lanczos
- gaussian
- tukey
- blackman
- exact_blackman
- kaiser
- nuttall
- blackman_harris
- blackman_nuttall
- flat_top
- blackman
The following windows can also accept an extra parameter, alpha:
- gaussian defaults to 0.4
- tukey defaults to 0.5
- kaiser defaults 0.3
You would use it like this:
`javascript
import windowing from "fft-windowing";
const raw = [2, 2, 0, -2, -2, 0, 2, 2];
const windowed = kaiser(raw, 0.5);
`
Run node tests/fft-windowing-tests.js`. This should apply each windowing function to a uniform array.
MIT