FrogSoundClassification / DataGenerator.py
yfyangd's picture
Upload DataGenerator.py
d0d3136
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import os
import pandas as pd
from pandas.core.frame import DataFrame
from tqdm import tqdm, tqdm_pandas
tqdm.pandas()
import librosa
import librosa.display
import matplotlib.pyplot as plt
def Data_Generator():
list_test = []
for j in os.listdir('./test/'):
list_test.append('./test/'+j)
fname = list_test[0]
return fname
def Audio(fname,SAMPLE_RATE):
# ζε–ζ™‚εŸŸιŸ³ι »θ³‡ζ–™
y, sr = librosa.load(fname, sr=SAMPLE_RATE)
# plot a waveform
plt.figure()
librosa.display.waveplot(y, sr)
plt.title('Waveplot of unknow frog sound')
plt.show()
return y,sr