def mfccFeature_audio(filename_wav,index_keep,feature_type='mfcc'):
audio = ess.MonoLoader(downmix = 'left', filename = filename_wav, sampleRate = fs)()
if feature_type == 'mfcc':
feature = getFeature(audio)
elif feature_type == 'mfccBands1D':
feature = getMFCCBands1D(audio)
elif feature_type == 'mfccBands2D':
feature = getMFCCBands2D(audio,nbf=True)
if feature_type == 'mfccBands1D' or feature_type == 'mfccBands2D':
feature = np.log(100000 * feature + 1)
scaler = pickle.load(open(kerasScaler_path,'rb'))
feature = scaler.transform(feature)
# feature = preprocessing.StandardScaler().fit_transform(feature)
# index_keep = pitchProcessing_audio(filename_wav)
feature_out = feature[index_keep[0],:]
for index in index_keep[1:]:
feature_out = np.vstack((feature_out,feature[index,:]))
if feature_type == 'mfccBands2D':
feature_out = featureReshape(feature_out)
return feature_out
targetAudioProcessing.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录