Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 scipy.fft()
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DtY




PostPosted: Mon Nov 09, 2009 10:17 pm   Post subject: scipy.fft()

I am trying to find the base frequency of an audio sample, wave form (amplitude vs. time). To do this, I am using the fast Fourier transform function that comes with scipy (This is what I want to use right?).
I ran it on a sample of a guitar note, and found it returns an array of complex numbers. Problem: I know nothing about imaginary/complex numbers, I'm not entirely sure what it means, or why fft would be returning that.
So, I read up on imaginary numbers (wikipedia) and found that:
Quote:
A 2-dimensional quantity can be represented mathematically as either a vector or as a complex number (known in the engineering context as phasor).

There doesn't seem to be a lot of documentation about this, or at least I can't find it, but my theory so far is that either the imaginary or real part of the number is the frequency, and the other part is the amplitude. Is this correct, of plausible?

I don't really know anything about signal processing, and there is a reason I didn't try to write my own Fourier transform function.
Does anyone who's used this before know how to get the useful information about it, or anyone who hasn't but has a better idea how to use it know?

Sample output from it:
code:
[-2230.00000000  +0.j         -2887.52212048-498.24603388j
  -925.89890202 +75.71956755j ...,  -222.85211598+849.75894479j
  -925.89890202 -75.71956755j -2887.52212048+498.24603388j]

(That's just the array fft() is returning)
I can post the whole array, if it might be helpful. The audio is the low E string on my acoustic guitar, it should be ~220Hz.

[edit] I forgot the mention, fft() didn't take a sampling frequency, so I am guessing it is not giving me frequency/time, but wave-length/time (period?)
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: