dancer.js
function FFT(bufferSize, sampleRate) {
  FourierTransform.call(this, bufferSize, sampleRate);
   
  this.reverseTable = new Uint32Array(bufferSize);

  var limit = 1;
  var bit = bufferSize >> 1;

  var i;

  while (limit < bufferSize) {
    for (i = 0; i < limit; i++) {
      this.reverseTable[i + limit] = this.reverseTable[i] + bit;
    }

    limit = limit << 1;
    bit = bit >> 1;
  }

  this.sinTable = new Float32Array(bufferSize);
  this.cosTable = new Float32Array(bufferSize);

  for (i = 0; i < bufferSize; i++) {
    this.sinTable[i] = Math.sin(-Math.PI/i);
    this.cosTable[i] = Math.cos(-Math.PI/i);
  }
}
function FFT(bufferSize, sampleRate) {
  FourierTransform.call(this, bufferSize, sampleRate);
   
  this.reverseTable = new Uint32Array(bufferSize);

  var limit = 1;
  var bit = bufferSize >> 1;

  var i;

  while (limit < bufferSize) {
    for (i = 0; i < limit; i++) {
      this.reverseTable[i + limit] = this.reverseTable[i] + bit;
    }

    limit = limit << 1;
    bit = bit >> 1;
  }

  this.sinTable = new Float32Array(bufferSize);
  this.cosTable = new Float32Array(bufferSize);

  for (i = 0; i < bufferSize; i++) {
    this.sinTable[i] = Math.sin(-Math.PI/i);
    this.cosTable[i] = Math.cos(-Math.PI/i);
  }
}
function FFT ( bufferSize , sampleRate ) { FourierTransform . call ( this , bufferSize , sampleRate ) ; this . reverseTable = new Uint32Array ( bufferSize ) ; var limit = 1 ; var bit = bufferSize >> 1 ; var i ; while ( limit < bufferSize ) { for ( i = 0 ; i < limit ; i ++ ) { this . reverseTable [ i + limit ] = this . reverseTable [ i ] + bit ; } limit = limit << 1 ; bit = bit >> 1 ; } this . sinTable = new Float32Array ( bufferSize ) ; this . cosTable = new Float32Array ( bufferSize ) ; for ( i = 0 ; i < bufferSize ; i ++ ) { this . sinTable [ i ] = Math . sin ( - Math . PI / i ) ; this . cosTable [ i ] = Math . cos ( - Math . PI / i ) ; } }
FFT is a class for calculating the Discrete Fourier Transform of a signal
with the Fast Fourier Transform algorithm.

@param {Number} bufferSize The size of the sample buffer to be computed. Must be power of 2
@param {Number} sampleRate The sampleRate of the buffer (eg. 44100)

@constructor
FFT is a class for calculating the Discrete Fourier Transform of a signal with the Fast Fourier Transform algorithm .