audio_utils.py 文件源码

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

项目:gcForest 作者: kingfengji 项目源码 文件源码
def get_feature_aqibsaeed_conv(X, sr, au_path=None):
    """
    http://aqibsaeed.github.io/2016-09-24-urban-sound-classification-part-2/
    """
    import librosa
    def windows(data, window_size):
        start = 0
        while start < len(data):
            yield start, start + window_size
            start += (window_size / 2)
    bands = 60
    frames = 41
    window_size = 512 * (frames - 1)
    for (start,end) in windows(X, window_size):
        if(len(X[start:end]) == window_size):
            signal = X[start:end]
            melspec = librosa.feature.melspectrogram(signal, n_mels = bands)
            logspec = librosa.logamplitude(melspec)
            logspec = logspec.T.flatten()[:, np.newaxis].T
            log_specgrams.append(logspec)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号