public double[] apply(double[] spectrumData) {

        if (spectrumData == null) {
            return null;
        }

        int specLen = spectrumData.length;
        int barkLen = getNumberOfBarkBands();

            // initialize output vector
        double[] barkSpec = new double[barkLen];

        // f ... frequency band, curFreq ... frequency represented by band f
        // f starts from 1 skipping DC component
        int b = 0; // b ... bark band index
        barkSpec[b] = 0;
        for (int f = 1; f < specLen / 2 + 1; f++) {
            double curFreq = f * this.binSizeHz;
            while (curFreq > BarkScale.BARK_LIMITS[b]) {
                b++;
                barkSpec[b] = 0;
            }

            barkSpec[b] += spectrumData[f];
        }

        return barkSpec;
    }