Skip to content

NatEvory/jsfft

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsfft

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

Usage

JSFFT ships with a complex_array and a fft module.

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

Including the fft module attaches FFT methods to ComplexArray:

var frequencies = data.FFT()
// Implement a low-pass filter using the in-place mapper.
frequencies.map(function(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:

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

Other Implementations

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

About

Small, efficient Javascript FFT implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors