Program: 20076
Project: 20076
Buggy source:
/** 
 * Build a mel filterbank with the parameters given. Each filter will be shaped as a triangle. The triangles overlap so that they cover the whole frequency range requested. The edges of a given triangle will be by default at the center of the  neighboring triangles.
 * @param NPoint number of points in the power spectrum
 * @param numberFilters number of filters in the filterbank
 * @param minFreq lowest frequency in the range of interest
 * @param maxFreq highest frequency in the range of interest
 */
private void buildFilterbank(int NPoint,int numberFilters,double minFreq,double maxFreq){
  double minFreqMel;
  double maxFreqMel;
  double deltaFreqMel;
  double leftEdge;
  double centerFreq;
  double centerFreqMel;
  double rightEdge;
  double rightEdgeMel;
  double initialFreqBin;
  double deltaFreq;
  this.filter=new MelFilter[numberFilters];
  minFreqMel=linToMelFreq(minFreq);
  maxFreqMel=linToMelFreq(maxFreq);
  deltaFreqMel=(maxFreqMel - minFreqMel) / (numberFilters + 1);
  deltaFreq=(double)sampleRate / NPoint;
  leftEdge=minFreq;
  centerFreqMel=minFreqMel + deltaFreqMel;
  centerFreq=melToLinFreq(centerFreqMel);
  for (int i=0; i < numberFilters; i++) {
    initialFreqBin=Math.round((leftEdge / deltaFreq) * (sampleRate / 2));
    rightEdgeMel=centerFreqMel + deltaFreqMel;
    rightEdge=melToLinFreq(rightEdgeMel);
    this.filter[i]=new MelFilter();
    this.filter[i].createMelFilter(leftEdge,centerFreq,rightEdge,initialFreqBin,deltaFreq,(sampleRate >> 1));
    leftEdge=centerFreq;
    centerFreq=rightEdge;
  }
}

Fixed version (ground truth):
/** 
 * Build a mel filterbank with the parameters given. Each filter will be shaped as a triangle. The triangles overlap so that they cover the whole frequency range requested. The edges of a given triangle will be by default at the center of the  neighboring triangles.
 * @param NPoint number of points in the power spectrum
 * @param numberFilters number of filters in the filterbank
 * @param minFreq lowest frequency in the range of interest
 * @param maxFreq highest frequency in the range of interest
 */
private void buildFilterbank(int NPoint,int numberFilters,double minFreq,double maxFreq){
  double minFreqMel;
  double maxFreqMel;
  double deltaFreqMel;
  double leftEdge;
  double centerFreq;
  double centerFreqMel;
  double rightEdge;
  double rightEdgeMel;
  double initialFreqBin;
  double deltaFreq;
  this.filter=new MelFilter[numberFilters];
  minFreqMel=linToMelFreq(minFreq);
  maxFreqMel=linToMelFreq(maxFreq);
  deltaFreqMel=(maxFreqMel - minFreqMel) / (numberFilters + 1);
  deltaFreq=(double)sampleRate / NPoint;
  leftEdge=minFreq;
  centerFreqMel=minFreqMel + deltaFreqMel;
  centerFreq=melToLinFreq(centerFreqMel);
  for (int i=0; i < numberFilters; i++) {
    initialFreqBin=Math.round((leftEdge / deltaFreq)) * deltaFreq;
    rightEdgeMel=centerFreqMel + deltaFreqMel;
    rightEdge=melToLinFreq(rightEdgeMel);
    this.filter[i]=new MelFilter();
    this.filter[i].createMelFilter(leftEdge,centerFreq,rightEdge,initialFreqBin,deltaFreq,(sampleRate >> 1));
    leftEdge=centerFreq;
    centerFreq=rightEdge;
    centerFreqMel=rightEdgeMel;
  }
}