Class: STFTSpectrogram::FFT::FFTComputation

Inherits:
Object
  • Object
show all
Defined in:
lib/stft/fft.rb

Overview

Implementation of the Fast Fourier Transform algorithm

Instance Method Summary collapse

Instance Method Details

#perform(data) ⇒ Object

Performs FFT on data Expects data in complex format - even indexes contain real numbers odd indexes contain imaginary numbers



10
11
12
13
14
15
16
# File 'lib/stft/fft.rb', line 10

def perform(data)
  unless pow2? data.length
    raise ArgumentError, 'Data array for FFT has to be power of 2 long'
  end
  data = reindex(data)
  danielson_lanzcos(data)
end