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)
评论列表
文章目录