         vDSP_fft_zrip(fftSetup!, &kernelTransformedComplex, 1, log2n, FFTDirection(FFT_FORWARD))
 
 
-        var yinStyleACFRealp = [Float](repeating: 0, count: inputCount)
-        var yinStyleACFImagp = [Float](repeating: 0, count: inputCount)
+        var yinStyleACFRealp = [Float](repeating: 0, count: frameSize)
+        var yinStyleACFImagp = [Float](repeating: 0, count: frameSize)
         var yinStyleACFComplex = DSPSplitComplex(realp: &yinStyleACFRealp, imagp: &yinStyleACFImagp)
 
         for j in 0 ..< inputCount {

            res + element * element
        }

        let powerTermFirstElement = buffer.reduce(0.0, addSquare)

        powerTerms[0] = powerTermFirstElement



        vDSP_fft_zrip(fftSetup!, &yinStyleACFComplex, 1, log2n, FFTDirection(FFT_INVERSE))

        var resultYinBuffer = [Float](repeating:0.0, count: yinBufferSize)

        for j in 0 ..< yinBufferSize {
            resultYinBuffer[j] = powerTerms[0] + powerTerms[j] - 2 * yinStyleACFRealp[j + yinBufferSize - 1]
        }

        return resultYinBuffer
    }

    class func cumulativeDifference(yinBuffer: inout [Float]) {
