Tree-Axis ``` Processing  


Back  
Class   FFT
   
Name  

maxAverages[]

   
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);
  
  // normalize the spectrum
  myFFT.limits();
  
  // we want 16 averages
  myFFT.averages(16);
  
  // 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<16; i++) {
    float temp=max(0,185-myFFT.maxAverages[i]*512);
    rect(i*16,temp+.5,16,height-temp+.5);
  }
}

// we are done, clean up Ess

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


Description   Contains maximum averages of spectrum bins from the last getSpectrum() call. Each time getSpectrum() is called each average is compared to a corresponding maximum average. If greater, it replaces it. If not, the maximum average is multiplied by updateMultiplier. The number of averages can be set with the averages() method. The default is 2
   
Syntax  
fft.maxAverages[]
   
Parameters  
fft   any instance of FFT

   
Usage   Web & Application
   
 
 






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


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