jsfft

Small, efficient Javascript FFT implementation

  • Owner: dntj/jsfft
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

jsfft

Small, efficient Javascript FFT implementation for node or the browser.

Usage

JSFFT ships with ComplexArray which can be operated on:

const fft = require('jsfft');

// Use the in-place mapper to populate the data.
const data = new fft.ComplexArray(512).map((value, i, n) => {
  value.real = (i > n/3 && i < 2*n/3) ? 1 : 0;
});

Including the fft module attaches FFT methods to ComplexArray. FFT and
InvFFT perform in-place transforms on the underlying data:

const frequencies = data.FFT();
// Implement a low-pass filter using the in-place mapper.
frequencies.map((frequency, i, n) => {
  if (i > n/5 && i < 4*n/5) {
    frequency.real = 0;
    frequency.imag = 0;
  }
});

Alternatively, frequency-space filters can be implemented via the frequencyMap:

const filtered = data.frequencyMap((frequency, i, n) => {
  if (i > n/5 && i < 4*n/5) {
    frequency.real = 0;
    frequency.imag = 0;
  }
});

Conventions

JSFFT uses the normalization convention that is symmetric between the forward and
reverse transform. With N data points, the transform is normalized by a factor of √N:

           1   N-1       2πik/N
fft(k) =   -    ∑  f(j) ?
          √N   j=0

Other Implementations

DSP is a full featured Digital Signal
Processing library in JS which includes a JS FFT implementation.

Main metrics

Overview
Name With Ownerdntj/jsfft
Primary LanguageJavaScript
Program languageCSS (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2012-09-30 18:30:59
Pushed At2020-11-03 11:21:11
Last Commit At2019-01-25 10:34:15
Release Count2
Last Release Namev0.0.4 (Posted on )
First Release Namev0.0.3 (Posted on )
用户参与
Stargazers Count285
Watchers Count17
Fork Count41
Commits Count54
Has Issues Enabled
Issues Count16
Issue Open Count2
Pull Requests Count3
Pull Requests Open Count0
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private