Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_spec(filename,input):
- plt.interactive(False)
- clip, sample_rate = librosa.load(input+filename + '.m4a', sr=None)
- fig = plt.figure(figsize=[0.72,0.72])
- ax = fig.add_subplot(111)
- ax.axes.get_xaxis().set_visible(False)
- ax.axes.get_yaxis().set_visible(False)
- ax.set_frame_on(False)
- S = librosa.feature.melspectrogram(y=clip, sr=sample_rate)
- librosa.display.specshow(librosa.power_to_db(S, ref=np.max))
- plt.savefig(input+filename+ '.png', dpi=400, bbox_inches='tight',pad_inches=0)
- plt.close()
- fig.clf()
- plt.close(fig)
- plt.close('all')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement