Tree-Axis ``` Processing  


Back  
Name  

FFT

   
Examples  
// Example by Krister Olsson

import krister.Ess.*;

AudioChannel myChannel;
FFT myFFT;

void setup() {
  size(256,200);

  // start up Ess
  Ess.start(this);

  // load "cell.aif" into a new AudioChannel
  myChannel=new AudioChannel("cell.aif");

  // we want 256 frequency bands, so we pass 512
  myFFT=new FFT(512);
  
  // start the sound looping forever
  myChannel.play(Ess.FOREVER);
  
  noStroke();
  fill(255);
}

void draw() {
  background(0,0,255);

  // get our spectrum
  myFFT.getSpectrum(myChannel);

  // draw our frequency bars
  for (int i=0; i<256; i++) {
    float temp=max(0,185-myFFT.spectrum[i]*512);
    rect(i,temp+.5,1,height-temp+.5);
  }
}

// we are done, clean up Ess

public void stop() {
  Ess.stop();
  super.stop();
}


Description   The FFT class is for the spectrum (and level) analysis of AudioChannels, AudioStreams, AudioInputs, and float arrays
   
   
Constructors  
FFT()
FFT(bins)
   
Parameters  
bins   int: the number of frequency bins (the size of spectrum will always be half this number). Must be a power of 2. The default is 512

   
Usage   Web & Application
   
 
 






   
 
Updated: Tue May 31 04:52:38 PDT 2006


 
  Questions, comments, corrections: e-mail Krister Olsson.