nasality.py 文件源码

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

项目:AutismVoicePrint 作者: opraveen 项目源码 文件源码
def create_labeled_data(aud_sample, nasal=0):

    num_windows = (len(aud_sample) - WINDOW_SIZE)/WINDOW_STRIDE

    features = np.zeros((num_windows, WINDOW_SIZE))
    labels = np.zeros(num_windows)

    idx = 0
    for i in range(0, len(aud_sample), WINDOW_STRIDE):

        window = aud_sample[i:i+WINDOW_SIZE]
        for j in range(len(window), WINDOW_SIZE):
            window = np.append(window,0)

        if is_periodic(window) is False:
           continue

        # FFT to shift to frequency domain - use frequency spectrum as features
        fft_values = abs(fft(window))

        feat = 20*scipy.log10(fft_values)

        features[idx:, ] = feat
        labels[idx] = nasal
        idx += 1
    return features[0:idx, ], labels[0:idx]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号