def get_mfcc_feat(self):
# creating codebook with all models
mfcc_feats = None
for filename in glob.iglob('../data/voices/*.wav'):
print filename
(rate, sig) = wav.read(filename)
# MFCC Features. Each row corresponds to MFCC for a frame
mfcc_person = mfcc(sig.astype(np.float64), rate)
if mfcc_feats is None:
mfcc_feats = mfcc_person
else:
mfcc_feats = np.concatenate((mfcc_feats, mfcc_person), axis=0)
# Normalize the features
whitened = whiten(mfcc_feats)
self.codebook, labeled_obs = kmeans2(data=whitened, k=3)
评论列表
文章目录