public void generateWindow(int bufferSize) {
        int lowerThresh = bufferSize / 4;
        int upperThresh = bufferSize - lowerThresh;
        buf = new float[bufferSize];
        for(int i = 0; i < bufferSize; i++) {
            if(i < lowerThresh || i > upperThresh) {
                buf[i] = 0.5f * (1.0f + (float)Math.cos((Math.PI + Math.PI * 4.0f * (float)i / (float)bufferSize)));
            } else {
                buf[i] = 1.0f;
            }
        }
    }