def _call(self, signal):
"""Compute MFCC features from an audio signal.
Args:
signal: the audio signal from which to compute features. Should be
an N*1 array
Returns:
A numpy array of size (NUMFRAMES by numcep) containing features.
Each row holds 1 feature vector.
"""
feat, energy = super(MFCC, self)._call(signal)
feat = np.log(feat)
feat = dct(feat, type=2, axis=1, norm='ortho')[:, :self.num_cep]
feat = self._lifter(feat, self.cep_lifter)
if self.append_energy:
# replace first cepstral coefficient with log of frame energy
feat[:, 0] = np.log(energy + self.eps)
if self.d:
d = delta(feat, 2)
feat = np.hstack([feat, d])
if self.dd:
feat = np.hstack([feat, delta(d, 2)])
return feat
评论列表
文章目录