Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

Added numerical stability … #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scikits/talkbox/features/mfcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down