def plot(self):
     plotAudio(temp2)
     self.graphpath = "frequency.png"
Exemplo n.º 2
0
tmp = list()
for x in libr.keys():
    tmp.append(x)

#####
# Bird types to choose from 0 to 14
t = tmp[2]

# ['azrm rep and soundfiles', 'bagm rep and soundfiles', 'bgmr rep and soundfiles',
# 'bgmy partial rep and soundfiles', 'bhmb prelim rep display and soundfiles',
# 'bmgw rep and soundfiles', 'bmor display and soundfiles done',
# 'bomp rep and soundfiles', 'boom rep and soundfiles', 'caim rep and soundfiles',
# 'ccym rep and soundfiles', 'cowm rep and soundfiles', 'cyom rep and soundfiles',
# 'ggmr rep and soundfiles', 'ggrm rep and soundfiles']

#Play ond plot bird songs counter # of times
counter = 10

for x in libr[t]:
    if counter == 0:
        break
    pth = song + t + "/" + x
    playAudio(pth)  # Play song
    plotAudio(pth)  # Plot song
    counter -= 1
'''
#To print the dictionary
for keys in libr.keys():
    print("keys:{}:{} {}\n".format(keys, len(libr[keys]),libr[keys]))
'''
Exemplo n.º 3
0
        pth = song + t + "/" + x
        paths.append(pth)
        counter -= 1

# In order to see the visual features
# of selected song change "HERE" -> paths["HERE"] until 706

#From here to
x, sr = librosa.load(paths[222])

librosa.load(paths[222])

#Set title of graphs
title = paths[222].split('/')[len(paths[222].split('/')) - 1]

plotAudio(paths[222])
#Here

X = librosa.stft(x)
Xdb = librosa.amplitude_to_db(abs(X))

plt.figure(figsize=(14, 5))
dsp.specshow(Xdb, sr=sr, x_axis='time', y_axis='hz')
plt.title(title)
plt.show()

#If to pring log of frequencies
dsp.specshow(Xdb, sr=sr, x_axis='time', y_axis='log')
plt.colorbar()
plt.title(title)
plt.show()