Squeak Class Documentation category index | class index  
 
FFT
  category: Sound-Synthesis
  superclass: Object
  subclasses:

This class implements the Fast Fourier Transform roughly as described on page 367
of "Theory and Application of Digital Signal Processing" by Rabiner and Gold.
Each instance caches tables used for transforming a given size (n = 2^nu samples) of data.

It would have been cleaner using complex numbers, but often the data is all real.

instance methods
  bulk processing
  initializeHammingWindow:
initializeTriangularWindow
setSize:
transformDataFrom:startingAt:

  initialization
  n
nu:
realData:
realData:imagData:

  plugin-testing
  pluginPrepareData
pluginTest
pluginTransformData:

  testing
  imagData
plot:in:
realData
samplesPerCycleForIndex:
test

  transforming
  permuteData
scaleData
transformForward:

class methods
  instance creation
  new:

instance methods
  bulk processing top  
 

initializeHammingWindow:

Initialize the windowing function to the generalized Hamming window. See F. Richard Moore, Elements of Computer Music, p. 100. An alpha of 0.54 gives the Hamming window, 0.5 gives the hanning window.


 

initializeTriangularWindow

Initialize the windowing function to the triangular, or Parzen, window. See F. Richard Moore, Elements of Computer Music, p. 100.


 

setSize:

Initialize variables and tables for performing an FFT on the given number of samples. The number of samples must be an integral power of two (e.g. 1024). Prepare data for use with the fast primitive.


 

transformDataFrom:startingAt:

Forward transform a block of real data taken from from the given indexable collection starting at the given index. Answer a block of values representing the normalized magnitudes of the frequency components.


  initialization top  
 

n


 

nu:

Initialize variables and tables for transforming 2^nu points


 

realData:


 

realData:imagData:


  plugin-testing top  
 

pluginPrepareData

The FFT plugin requires data to be represented in WordArrays or FloatArrays


 

pluginTest

Display restoreAfter: [(FFT new nu: 12) pluginTest].


 

pluginTransformData:

Plugin testing -- if the primitive is not implemented
or cannot be found run the simulation. See also: FFTPlugin


  testing top  
 

imagData


 

plot:in:

Throw-away code just to check out a couple of examples


 

realData


 

samplesPerCycleForIndex:

Answer the number of samples per cycle corresponding to a power peak at the given index. Answer zero if i = 1, since an index of 1 corresponds to the D.C. component.


 

test

Display restoreAfter: [(FFT new nu: 8) test]. -- Test on an array of 256 samples


  transforming top  
 

permuteData


 

scaleData

Scale all elements by 1/n when doing inverse


 

transformForward:


class methods
  instance creation top  
 

new:

Answer a new FFT instance for transforming data packets of the given size.