# jsfft

> A lightweight FFT implementation for Javascript

Latest version **0.0.4** (published 2019-01-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsfft
pnpm add jsfft
yarn add jsfft
bun add jsfft
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2019-01-24 |
| First published | 2017-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 0 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 287 |
| Author | Nick Jones |
| Maintainers | dntj |

## Links

- npm: https://www.npmjs.com/package/jsfft
- Repository: https://github.com/dntj/jsfft
- Homepage: https://github.com/dntj/jsfft#readme
- Issues: https://github.com/dntj/jsfft/issues
- npm.io page: https://npm.io/package/jsfft

## Recent versions

- 0.0.4 (latest) — 2019-01-24
- 0.0.3 — 2017-07-18
- 0.0.2 — 2017-02-10

## README

# jsfft

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

## Usage

JSFFT ships with **ComplexArray** which can be operated on:

```javascript
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:

```javascript
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:

```javascript
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](https://github.com/corbanbrook/dsp.js) is a full featured Digital Signal
Processing library in JS which includes a JS FFT implementation.

---
_Source: https://npm.io/package/jsfft · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
