Tree-Axis ``` Processing  


Back  
Class   FFT
   
Name  

limits()

   
Examples  
// Example by Krister Olsson

import krister.Ess.*;

AudioChannel myChannel;
FFT myFFT;

boolean limit=true;

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);
  
  // normalize our spectrum data
  myFFT.limits();

  // 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]*185);
    rect(i,temp+.5,1,height-temp+.5);
  }
}

void keyPressed() {
  // toggle limits
  limit=!limit;
  
  if (limit) myFFT.limits();
  else myFFT.noLimits();
}

// we are done, clean up Ess

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


Description   Normalize spectrum data
   
Syntax  
fft.limits()
fft.limits(min, max)
   
Parameters  
fft   any instance of FFT

min   float: minimum spectrum value for nornalization. Default is .005

max   float: maximum spectrum value for normalization. Default is .05

   
Returns   nothing
   
Usage   Web & Application
   
 
 






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


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