FFT woes

Bruce Conlon vitamonkey at hotmail.com
Tue Dec 31 14:58:31 EST 2002


Hello,
I'm very green at signal processing and only have a passing grasp of the
subject, and am trying to play with an example I found here (
http://www.onlamp.com/pub/a/python/2001/01/31/numerically.html ) using a
sampled wave. I'm trying to plot the FFT of the wave using DISLIN but am
getting strange results (if any).  If anyone could lend a hand, I would
greatly appreciate it.
Thanks,
Bruce

------CODE------
from dislin import *
from Numeric import *
import FFT
import wave

filename = "input3.wav"
input = wave.open(filename, "r")
numsamp = input.getnframes()

y = array(input.readframes(numsamp), Float32)
x = arange(numsamp, typecode=Float32)

yray = 10*log10(absolute(FFT.real_fft(y)))
#should work? overflow exception...why?
#I can work around it by adding (right inside log10 )
#a small (negligible) number like 1e-20 but dont see the why

yray = array(yray.tolist()[0:-1])
#above list comes out one element greater
# than below so have to chop one off
xray = x[0:(len(yray.tolist()))]

setvar('T1','FFT Plot of '+filename)
setvar('X','Frequency')
setvar('Y','Amplitude')

plot(xray,yray)
disfin()





More information about the Python-list mailing list