# time and frequency displays

from math import *
import numpy as np
from scipy.io.wavfile import read
from scipy.fftpack import rfft
import matplotlib.pyplot as plt

fileName='sawflt.wav'
(freqSamp,wavData)=read(fileName)
freqNote=210
print(freqSamp,wavData)

plt.ion()
plt.figure(1)
# plt.suptitle(fileName,fontsize=18)
plt.subplot(211)
plt.plot(wavData[0:freqNote])
plt.title('time')
plt.grid()
plt.subplot(212)
plt.semilogx()
plt.title('freq')
plt.grid()
plt.plot(abs(rfft(wavData))/32768)