Accelerate mfcc computation for DS2.

pull/2/head
Xinghai Sun 8 years ago
parent 6df0f9bc44
commit 961f6a2963

@ -166,21 +166,18 @@ class AudioFeaturizer(object):
"window size.") "window size.")
# compute 13 cepstral coefficients, and the first one is replaced # compute 13 cepstral coefficients, and the first one is replaced
# by log(frame energy) # by log(frame energy)
mfcc_feat = mfcc( mfcc_feat = np.transpose(
signal=samples, mfcc(
samplerate=sample_rate, signal=samples,
winlen=0.001 * window_ms, samplerate=sample_rate,
winstep=0.001 * stride_ms, winlen=0.001 * window_ms,
highfreq=max_freq) winstep=0.001 * stride_ms,
highfreq=max_freq))
# Deltas # Deltas
d_mfcc_feat = delta(mfcc_feat, 2) d_mfcc_feat = delta(mfcc_feat, 2)
# Deltas-Deltas # Deltas-Deltas
dd_mfcc_feat = delta(d_mfcc_feat, 2) dd_mfcc_feat = delta(d_mfcc_feat, 2)
# concat above three features # concat above three features
concat_mfcc_feat = [ concat_mfcc_feat = np.concatenate(
np.concatenate((mfcc_feat[i], d_mfcc_feat[i], dd_mfcc_feat[i])) (mfcc_feat, d_mfcc_feat, dd_mfcc_feat))
for i in xrange(len(mfcc_feat))
]
# transpose to be consistent with the linear specgram situation
concat_mfcc_feat = np.transpose(concat_mfcc_feat)
return concat_mfcc_feat return concat_mfcc_feat

Loading…
Cancel
Save