import matplotlib.pyplot as plt from scipy import signal from scipy.io import wavfile sample_rate, samples = wavfile.read('out.wav') print(sample_rate) frequencies, times, spectrogram = signal.spectrogram(samples, sample_rate) plt.pcolormesh(times, frequencies, spectrogram) plt.imshow(spectrogram) plt.ylabel('Frequency [Hz]') plt.xlabel('Time [sec]') plt.show()