changeset 24:34b4b44299be

getMFCCs(): prevent issue with silence producing infinities (cherry picked from commit 68e18c44dfdac06ca6967ce79ff7ae1806b4b0ee)
author Dan Stowell <danstowell@users.sourceforge.net>
date Thu, 24 Oct 2013 08:37:00 +0100
parents 8319429b20da
children d61638e45c34
files MFCC.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MFCC.py	Wed Feb 13 16:45:35 2013 +0000
+++ b/MFCC.py	Thu Oct 24 08:37:00 2013 +0100
@@ -101,7 +101,7 @@
 		
 	def getMFCCs(self,warpedSpectrum,cn=True):
 		'''Compute MFCC coefficients from Mel warped magnitude spectrum.'''
-		mfccs=self.dct(numpy.log(warpedSpectrum))
+		mfccs=self.dct(numpy.log(numpy.clip(warpedSpectrum, 1e-9, numpy.inf)))
 		if cn is False : mfccs[0] = 0.0
 		return mfccs