I want to use the audio spectrogram plots for machine learning and I am using
librosa to get the plots.
However, when I get the plots, I am getting these white patches that I want to get rid of. I have tried various things like these but nothing seems to work. when I try to get the shape of the plot, I get the size of the plot only but when I get the array, it gives the array with the white patches. Is there a way I get the plot only so that I can use it in my machine learning task? Please let me know.
Here is the code:
x = librosa.load('LibriSpeech/train-clean-100/19/198/19-198-0001.flac', sr=16000) X = librosa.stft(x) #converting into energy levels(dB) Xdb = librosa.amplitude_to_db(abs(X)) fig, ax = plt.subplots() plt.box(on=None) img = librosa.display.specshow(Xdb) ax.axis('off') fig.patch.set_visible(False)
I get the shape of the plot through
img.figure.get_size_inches()*img.figure.get_dpi() and the array as
img.get_array() but they don’t match.
Here’s the link to the audio file