diff --git a/SyllableDetector/CircularShortTimeFourierTransform.swift b/SyllableDetector/CircularShortTimeFourierTransform.swift index 333f19a..6bbd25c 100644 --- a/SyllableDetector/CircularShortTimeFourierTransform.swift +++ b/SyllableDetector/CircularShortTimeFourierTransform.swift @@ -82,6 +82,11 @@ class CircularShortTimeFourierTransform guard v.isPowerOfTwo() else { fatalError("The FFT size must be a power of 2.") } + + guard lengthWindow <= v else { + fatalError("The FFT size must be greater than or equal to the window length.") + } + lengthFft = v fftSize = vDSP_Length(ceil(log2(CDouble(v)))) }