import numpy as np def save_data_to_array(path=DATA_PATH, max_pad_len=11): labels, _, _ = get_labels(path) for label in labels: # Init mfcc vectors mfcc_vectors = [] wavfiles = [path + label + '/' + wavfile for wavfile in os.listdir(path + '/' + label)] for wavfile in wavfiles: mfcc = wav2mfcc(wavfile, max_pad_len=max_pad_len) mfcc_vectors.append(mfcc) np.save(label + '.npy', mfcc_vectors)