Answer the question
In order to leave comments, you need to log in
Spectrogram audio python matplotlib: how to change color and add intensity scale?
There is a code
import matplotlib.pyplot as plt
import scipy.io.wavfile
sample_rate, X = scipy.io.wavfile.read('TEST2.wav')
print(sample_rate, X.shape)
plt.specgram(X[:, 0], NFFT=256, Fs=sample_rate)
plt.show()
Answer the question
In order to leave comments, you need to log in
Hooray!
Thanks Andy_U !
import matplotlib.pyplot as plt
import scipy.io.wavfile
sample_rate, X = scipy.io.wavfile.read('TEST2.wav')
print(sample_rate, X.shape)
plt.xlabel('Время, c', fontsize='x-large')
plt.ylabel('Частота, Гц', fontsize='x-large')
plt.title('Спектрограмма для колбы')
cmap = plt.get_cmap('magma')
plt.specgram(X[:, 0], NFFT=256, pad_to=256, mode='magnitude', Fs=sample_rate, cmap=cmap)
plt.colorbar()
plt.show()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question