unlekker.util
Class FFTHelper

java.lang.Object
  extended by unlekker.util.FFTHelper

public class FFTHelper
extends java.lang.Object

Utility class to normalize and dampen results from FFT analysis, giving a more reliable output. Essentially functions as a peak follower. Use setDamper() to adjust damping factor, call update() with an array containing your FFT results.

Author:
Marius Watz

Field Summary
 float[] band
           
 float[] bandmax
           
 int bandsteps
           
 double dampDown
           
 double dampUp
           
 double masterVol
           
 float max
           
 double maxinternal
           
 float maxMaximum
           
 float maxMinimum
           
 int num
           
 int numbands
           
 float[] spectrum
           
 float[] spectrumD
           
 float[] spectrumLast
           
 float[] ttv
           
 double[] v
           
 
Constructor Summary
FFTHelper(int _n, int _nbands, boolean _doDelta)
           
 
Method Summary
 double checkBandMax(int valid)
           
 float dampenVal(double oldval, double newval)
           
 void setDamper(double _d)
           
 void setDamper(double _dup, double _ddown)
           
 void setMaxLimits(float _min, float _max)
           
 void setVolume(double _vol)
           
 void update(float[] nv)
           
 void update(float[] nv, int start, int length)
           
 void updateBands(float[] nv, int div)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

num

public int num

numbands

public int numbands

spectrum

public float[] spectrum

spectrumD

public float[] spectrumD

spectrumLast

public float[] spectrumLast

ttv

public float[] ttv

v

public double[] v

dampUp

public double dampUp

dampDown

public double dampDown

masterVol

public double masterVol

maxinternal

public double maxinternal

max

public float max

maxMinimum

public float maxMinimum

maxMaximum

public float maxMaximum

band

public float[] band

bandmax

public float[] bandmax

bandsteps

public int bandsteps
Constructor Detail

FFTHelper

public FFTHelper(int _n,
                 int _nbands,
                 boolean _doDelta)
Method Detail

setMaxLimits

public void setMaxLimits(float _min,
                         float _max)

setDamper

public void setDamper(double _dup,
                      double _ddown)

setDamper

public void setDamper(double _d)

setVolume

public void setVolume(double _vol)

dampenVal

public float dampenVal(double oldval,
                       double newval)

update

public void update(float[] nv)

update

public void update(float[] nv,
                   int start,
                   int length)

updateBands

public void updateBands(float[] nv,
                        int div)

checkBandMax

public double checkBandMax(int valid)