Doppler effect

In [1]:
import numpy as np;
import matplotlib.pyplot as plt;
plt.rcParams.update({"text.usetex":True});
%config InlineBackend.figure_format = "svg"
import scipy.io.wavfile as sw
In [2]:
sam, d = sw.read("horn.wav");
#tf = 9;
#print(sam)
#d1 = d[:tf*sam];
t = np.arange(np.size(d))*1/sam;
plt.plot(t, d);
plt.title("audio of a moving sound source")
plt.xlabel("time");
plt.ylabel("waveform")
Out[2]:
Text(0, 0.5, 'waveform')
In [3]:
#plt.figure(figsize=(10,8))
plt.specgram(np.abs(d), Fs = sam, cmap='jet');
#plt.yscale("log")
F:\anaconda\lib\site-packages\matplotlib\axes\_axes.py:7592: RuntimeWarning: divide by zero encountered in log10
  Z = 10. * np.log10(spec)
In [ ]: