targetAudioProcessing.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:jingjuSingingPhraseMatching 作者: ronggong 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号