MATLAB Answers


How to fix invalid window length in MFCC function of matlab R2018a ?

Asked by inggi ramadhani on 9 Dec 2018
Latest activity Answered by Jeyson Ardila on 28 Feb 2019
I use frequency sampling of 250 Hz. I've set the window length to 25 ms and overlap 15 ms. But it shows :
Invalid window length. WINDOWLENGTH must be in the range [2,size(x,1)], where x is the audio input.
The default window length depends on the specified sample rate: round(fs*0.03).
What should I do?


Show 1 older comment
% coeffs = MFCC(...,'OverlapLength',OVERLAPLENGTH) specifies the number
% of samples overlap between adjacent windows. Specify the overlap length
% as a positive scalar smaller than the window length. If unspecified,
% OVERLAPLENGTH defaults to round(fs*0.02).
I've set the overlap to 12. But it shows another error
Error using coder.internal.assert (line 33)
Mismatch between NumCoeffs and number of valid bandpass filters.
Specify NumCoeffs as less than or equal to the number of valid bandpass filters.
Error in coder.internal.errorIf (line 7)
coder.internal.assert(~cond, msgID, varargin{:});
Error in audio.internal.AuditoryCepstralCoefficients/verifyNumCoeffs (line 369)
coder.internal.errorIf(obj.NumCoeffs > obj.poNumValidBands, ...
Error in audio.internal.AuditoryCepstralCoefficients/setupImpl (line 193)
Error in mfcc (line 93)
coeffs(:,:,chan) = (mfccObject(y))';
Error in roadto250 (line 8)
coeff = mfcc(norm,250,'WindowLength',25,'OverlapLength',12)
What should I do?

Sign in to comment.


1 Answer

Answer by Jeyson Ardila on 28 Feb 2019

I know I'm late, but just for reference, I had the same problem as you
  • 'Invalid window length.'
The audio signals I was trying to input where of size 1xNsamples, this error was fixed by trasposing the signals to Nsamples x 1
  • Mismatch between NumCoeffs and number of valid bandpass filters.
The default NumCoeffs is 13, specifying ('NumCoeffs',12 ) fixed it for me. If it doesn't for you, you'll have to lower the value until it does.


Sign in to comment.