【发布时间】:2016-10-24 02:25:22
【问题描述】:
使用 Librosa 库,我将音频文件 1319 秒的 MFCC 特征生成为矩阵20 X 56829。这里的20 代表MFCC 功能的数量(我可以手动调整)。但我不知道它是如何将音频长度分割成56829。处理音频所需的帧大小是多少?
import numpy as np
import matplotlib.pyplot as plt
import librosa
def getPathToGroundtruth(episode):
"""Return path to groundtruth file for episode"""
pathToGroundtruth = "../../../season01/Audio/" \
+ "Season01.Episode%02d.en.wav" % episode
return pathToGroundtruth
def getduration(episode):
pathToAudioFile = getPathToGroundtruth(episode)
y, sr = librosa.load(pathToAudioFile)
duration = librosa.get_duration(y=y, sr=sr)
return duration
def getMFCC(episode):
filename = getPathToGroundtruth(episode)
y, sr = librosa.load(filename) # Y gives
data = librosa.feature.mfcc(y=y, sr=sr)
return data
data = getMFCC(1)
【问题讨论】:
-
您能提供您使用的代码吗?
-
用代码更新了问题
标签: python-3.x audio mfcc