diff --git a/scikits/talkbox/features/mfcc.py b/scikits/talkbox/features/mfcc.py index 453b4a5..9db9493 100644 --- a/scikits/talkbox/features/mfcc.py +++ b/scikits/talkbox/features/mfcc.py @@ -105,7 +105,8 @@ def mfcc(input, nwin=256, nfft=512, fs=16000, nceps=13): # Compute the spectrum magnitude spec = np.abs(fft(framed, nfft, axis=-1)) # Filter the spectrum through the triangle filterbank - mspec = np.log10(np.dot(spec, fbank.T)) + epsilon = 1e-6 + mspec = np.log10(np.dot(np.maximum(spec, epsilon), fbank.T)) # Use the DCT to 'compress' the coefficients (spectrum -> cepstrum domain) ceps = dct(mspec, type=2, norm='ortho', axis=-1)[:, :nceps]