in 01-byoc/code/dataset.py [0:0]
def read_data(self, csvfile):
"""Read wav file from csv
Args:
csvfile: A string specifying the path of csvfile
Return:
data: A list of tuple (wav data in np.int16 data type, sampling rate of wav file)
label: A list of labels corresponding to the wav data
filenames: A list of filenames of the wav file
"""
df = pd.read_csv(csvfile)
data, label, filenames = [], [], []
print("reading wav files...")
for i in tqdm(range(len(df))):
row = df.iloc[i]
path = os.path.join(self.data_dir, row.Filename + ".wav")
wav_data, sr = wav_read(path)
assert wav_data.dtype == np.int16
data.append((wav_data, sr))
label.append(row.Label)
filenames.append(path)
return data, label, filenames