@Override public double[] analyse(double[] aFrame){
  if (aFrame.length != frameLength)   throw new IllegalArgumentException("Expected frame of length " + frameLength + ", got "+ aFrame.length);
  double[] real=new double[fftSize];
  double[] imag=new double[fftSize];
  System.arraycopy(aFrame,0,real,0,aFrame.length);
  FFT.transform(real,imag,false);
  MathUtils.toPolarCoordinates(real,imag);
  real=MathUtils.log(real);
  Arrays.fill(imag,0.);
  double b=5000;
  int bIndex=(int)(b / frequencyResolution);
  double[] invReal;
  double[] invImag;
  if (invFftSize == fftSize) {
    invReal=real;
    invImag=imag;
  }
 else {
    invReal=new double[invFftSize];
    System.arraycopy(real,0,invReal,0,bIndex + 1);
    invImag=new double[invFftSize];
  }
  for (int i=bIndex + 1; i < invFftSize / 2; i++) {
    invReal[i]=invReal[bIndex];
  }
  for (int i=0; i < invFftSize / 2; i++) {
    invReal[invFftSize - i - 1]=invReal[i];
  }
  FFT.transform(invReal,invImag,true);
  return invReal;
}

@ Override public double [ ] analyse ( double [ ] aFrame ) { if ( aFrame . length != frameLength ) throw new IllegalArgumentException ( "Expected frame of length " + frameLength + ", got " + aFrame . length ) ; double [ ] real = new double [ fftSize ] ; double [ ] imag = new double [ fftSize ] ; System . arraycopy ( aFrame , 0 , real , 0 , aFrame . length ) ; FFT . transform ( real , imag , false ) ; MathUtils . toPolarCoordinates ( real , imag ) ; real = MathUtils . log ( real ) ; Arrays . fill ( imag , 0. ) ; double b = 5000 ; int bIndex = ( int ) ( b / frequencyResolution ) ; double [ ] invReal ; double [ ] invImag ; if ( invFftSize == fftSize ) { invReal = real ; invImag = imag ; } else { invReal = new double [ invFftSize ] ; System . arraycopy ( real , 0 , invReal , 0 , bIndex + 1 ) ; invImag = new double [ invFftSize ] ; } for ( int i = bIndex + 1 ; i < invFftSize / 2 ; i ++ ) { invReal [ i ] = invReal [ bIndex ] ; } for ( int i = 0 ; i < invFftSize / 2 ; i ++ ) { invReal [ invFftSize - i - 1 ] = invReal [ i ] ; } FFT . transform ( invReal , invImag , true ) ; return invReal ; }
apply this framebasedanalyser to the given data .
