Skip to content

Instantly share code, notes, and snippets.

@gilesc
Created October 2, 2010 15:21
Show Gist options
  • Select an option

  • Save gilesc/607717 to your computer and use it in GitHub Desktop.

Select an option

Save gilesc/607717 to your computer and use it in GitHub Desktop.
from numpy import argmax
from scipy import arange
from scipy.io import wavfile
from scipy.fftpack import fftfreq, rfft, fftshift
import pylab
sample_rate, signal = wavfile.read("goodnight.wav")
N = len(signal)
Fs = sample_rate
Ts = 1./Fs
freq_step = Fs/N
Y = fftshift(rfft(signal))
freq = freq_step * arange(-N/2,N/2)
pylab.plot(freq, abs(Y))
pylab.show()
print Y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment