Giter VIP home page Giter VIP logo

fft.js's Introduction

FFT

Compact Fast Fourier transform function in JavaScript based on the Cooley–Tukey algorithm with a demo page that illustrates the use of window functions and a simple spectrogram.

Demo

  • Clone the repository
  • Open the file index.html with any web browser

This demo also illustrates the use of window functions and a simple spectrogram.

Live Demo

https://ciiec.buap.mx/FFT.js/

Usage

Assuming x is the time domain array of size N with the sampled data, where N is a power of 2, then

 fft = FFT(x);

 X_real = new Array(my_x.length / 2).fill(0);

 X_imag = new Array(my_x.length / 2).fill(0);

 X_abs = new Array(my_x.length / 2).fill(0);

 for (var i = 0; i < N / 2; i += 1) {

     X_real[i] = fft[i].re;
  
     X_imag[i] = fft[i].im;
  
     X_abs[i] = Math.sqrt(fft[i].re * fft[i].re + fft[i].im * fft[i].im);

 }

where

fft is FFT{x} and X_real, X_imag and X_abs are the frequency domain arrays containing the real, imaginary and absolute values, respectively. The size of fft is N and the size of the other arrays is N/2.

Credits

License

MIT

fft.js's People

Contributors

lvillasen avatar

Stargazers

 avatar  avatar Eduardo Villaseñor avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.