double[] whiten(double[] dataIn,PolyphonicPitchDetection mainProgram){
		double[] whitened = new double[dataIn.length];

		/*Calculate signal energies in filter windows??*/
		Vector<Double> gammab = new Vector<Double>();
		Vector<Double> stdb = new Vector<Double>();

		int kk;
		/*The filter bank Hb could be pre-calculated, to be implemented...*/
		for (int i = 0;i<mainProgram.Hb.length;++i){
			double tempSum = 0;
			for (int j = 0;j< mainProgram.Hb[i].size();++j){
				tempSum += mainProgram.Hb[i].get(j)*Math.pow(dataIn[mainProgram.hbIndices[i].get(j)],2.0);
			}
			stdb.add(Math.sqrt(tempSum/((double)dataIn.length)));
			gammab.add(Math.pow(stdb.lastElement(),0.33-1.0));
		}

		//Interpolate gammab...
		gammaCoeff =new double[dataIn.length];

		kk=0;
		while (mainProgram.freq[kk] < mainProgram.cb[1]){	//Search for the first frequency..
			gammaCoeff[kk] = gammab.get(0);
			++kk;
		}
		double whitemax=0;
		for (int i = 0;i<gammab.size()-1;++i){
		   	int init = ind(mainProgram.freq,mainProgram.cb[i+1]);
			int end = ind(mainProgram.freq,mainProgram.cb[i+2]);
			while (kk < end){
				gammaCoeff[kk] = gammab.get(i)+(gammab.get(i+1)-gammab.get(i))*Math.abs((double)(kk-init))/((double) (end-init));
				++kk;
			}
		}
		/*Fill in the rest of the whitened with the last gammab*/
		while (kk<whitened.length){
			gammaCoeff[kk] = gammab.get(gammab.size()-1);
			++kk;
		}
		/*whiten the signal*/
		for (int i = 0; i<whitened.length;++i){
			whitened[i] = dataIn[i]*gammaCoeff[i];
		}
		return whitened;
	}