how to load wav file python

Solutions on MaxInterview for how to load wav file python by the best coders in the world

showing results for - "how to load wav file python"
Blanche
25 Jan 2016
1import matplotlib.pyplot as plt
2from scipy import signal
3from scipy.io import wavfile
4
5sample_rate, samples = wavfile.read('path-to-mono-audio-file.wav')
6frequencies, times, spectrogram = signal.spectrogram(samples, sample_rate)
7
8plt.pcolormesh(times, frequencies, spectrogram)
9plt.imshow(spectrogram)
10plt.ylabel('Frequency [Hz]')
11plt.xlabel('Time [sec]')
12plt.show()