def loadFile(self, fname):
'''
fname: filename of the sound file we want to load
'''
if self.verbose: print('Loading %s' % fname)
if self.cached:
if not os.path.exists(fname + '-mfcc.npy'):
y, sr = librosa.load(fname)
data = mfcc(y=y, sr=sr).T
np.save(fname + '-mfcc.npy', data)
else:
data = np.load(fname + '-mfcc.npy')
else:
y, sr = librosa.load(fname)
# TODO: Add ability to filter by seconds/duration
# seconds = y.size/sr
data = mfcc(y=y, sr=sr).T
return data
评论列表
文章目录