lib/minim/src/ddf/minim/analysis/FourierTransform.java
/**
   * Returns the index of the frequency band that contains the requested
   * frequency.
   * 
   * @param freq
   *          float: the frequency you want the index for (in Hz)
   *          
   * @return int: the index of the frequency band that contains freq
   * 
   * @related FFT
   * 
   * @example Analysis/SoundSpectrum
   */
Returns the index of the frequency band that contains the requested
frequency.

@param freq
float: the frequency you want the index for (in Hz)

@return int: the index of the frequency band that contains freq

@related FFT


Returns the index of the frequency band that contains the requested frequency . @param freq float : the frequency you want the index for ( in Hz ) @return int : the index of the frequency band that contains freq @related FFT
public int freqToIndex(float freq)
  {
    if (freq < getBandWidth() / 2) return 0;
    if (freq > sampleRate / 2 - getBandWidth() / 2) return spectrum.length - 1;
    float fraction = freq / (float) sampleRate;
    int i = Math.round(timeSize * fraction);
    return i;
  }
public int freqToIndex ( float freq ) { if ( freq < getBandWidth ( ) / 2 ) return 0 ; if ( freq > sampleRate / 2 - getBandWidth ( ) / 2 ) return spectrum . length - 1 ; float fraction = freq / ( float ) sampleRate ; int i = Math . round ( timeSize * fraction ) ; return i ; }
Returns the index of the frequency band that contains the requested
 frequency.
Returns the index of the frequency band that contains the requested frequency .
// special case: freq is lower than the bandwidth of spectrum[0] // special case: freq is within the bandwidth of spectrum[spectrum.length - 1] // all other cases