Skip to content

eleven-i/fft-windowing-ts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fft-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 richardeoin@gmail.com's package https://github.com/richardeoin/nodejs-fft-windowing. Typescript has been added, and it's now an ES6 module which can be easily imported into new projects. I don't pretend the blackman function has a variable alpha (I may fix this at some point)

This article by National Instruments gives a good introduction to why windowing functions are useful.

Installation

If you have npm installed, just run:

yarn add fft-windowing

Usage

The Hann (Hanning) window is a good general-purpose window. You would use it like so:

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.

Alternatively you could use spectral-analysis which is a package which combines this windowing package with kissfft-js making it an all in one solution like scipy.signal.welch.

The following windows are available:

The following windows can also accept an extra parameter, alpha:

You would use it like this:

import windowing from "fft-windowing";

const raw = [2, 2, 0, -2, -2, 0, 2, 2];

const windowed = kaiser(raw, 0.5);

Tests

Run node tests/fft-windowing-tests.js. This should apply each windowing function to a uniform array.

LICENSE

MIT

About

Applies a windowing function to an array of data, making it ready to be FFT'd.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 92.1%
  • JavaScript 7.9%