fft-radix2

Fast fourier transform using radix-2 Cooley-Tukey algorithm

npm install dsp-fft-radix2

This module have functions to compute a Fast Fourier transform either in forward and inverse versions. The code is adapted from the unmaintained dsp.js library.

This is part of dsp-kit

Source:
Example
var fftRadix2 = require('dsp-fft-radix2')
var ft = fftRadix2(1024)
ft.forward(signal)
ft.inverse(signal)

Methods

(static) fftRadix2(size) → {Object.<forward, inverse>}

Create a Fast Fourier Transform functions

It returns an object with two funtions: forward and inverse. Both accepts a signal and (optionally) an output buffer to store the results (to reduce memory allocation).

Parameters:
Name Type Description
size Integer

the FFT size

Source:
Returns:

fourier transform functions

Type
Object.<forward, inverse>
Example
var fftRadix2 = require('dsp-fft-radix2')
var ft = fftRadix2(1024)
// Given a signal (a Float32Array) ...
output = { real: new Float32Array(1024), imag: new Float32Array(1024) }
ft.forward(signal, output)
// it's invertible
ft.inverse(output).real === signal