%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
import IPython.display as ipd
from scipy.io import wavfile
from spectrogramtools import *
# We'll load in a 10 second clip of Prince's "When Doves Cry" and play it in Jupyter
sr, x = wavfile.read("doves.wav")
x = x/32768
ipd.Audio(x, rate=sr)
<ipython-input-2-21ff215028c7>:2: WavFileWarning: Chunk (non-data) not understood, skipping it. sr, x = wavfile.read("doves.wav")
# Now we'll compute and plot the spectrogram
win = 2048
hop = 128
S = np.abs(stft(x, win, hop))
plt.figure(figsize=(12, 5))
plot_specgram(S, sr, win, hop)
plt.ylim([0, 6000])
(0.0, 6000.0)