Prev: CIC filter response
Next: dealing with aliasing
From: Raeldor on 18 Jun 2010 16:02 Hi All, I'm a pretty good programmer, but not a good mathematician, and have been trying to read up on FFT, but it breaks into complex math formulas way to early for me. I want to be able to take raw WAV data in a single dimensional array and convert it into a 2-dimensional array where the first dimension index represents the frequency and the second dimension index represents the time, and the values in the array represent the intensity of the frequency at that point in time. Basically it should look like a spectrum analysis. Is this easily done? I found a library called FFTW, but would anyone have any sample code to do such a transformation or could give me some pointers what I should be calling? Thanks! Ray
From: glen herrmannsfeldt on 18 Jun 2010 16:47 Raeldor <raeldor(a)gmail.com> wrote: > I'm a pretty good programmer, but not a good mathematician, and have > been trying to read up on FFT, but it breaks into complex math > formulas way to early for me. Read up on the Fourier series. You don't need complex (as in real and imaginary) for that, and it is closer to what FFT actually does. > I want to be able to take raw WAV data in a single dimensional array > and convert it into a 2-dimensional array where the first dimension > index represents the frequency and the second dimension index > represents the time, and the values in the array represent the > intensity of the frequency at that point in time. The real Fourier transform takes a time domain signal and converts it to frequency, not as a function of time. That is a little hard to explain starting from the spectrum analyzer viewpoint, or even from the human ear viewpoint. It is a little easier to understand starting with the Fourier series, which works for periodic functions, but again the result is all frequency with no time dependence. -- glen
From: Raeldor on 18 Jun 2010 16:52 Thanks for the reply, Glen. Is it possible I can just break the sample up into small time portions and then concatenate the results into a time-based array?
From: glen herrmannsfeldt on 18 Jun 2010 17:43 Raeldor <raeldor(a)gmail.com> wrote: (snip on spectrum analyzers and FFT) > Thanks for the reply, Glen. Is it possible I can just break the > sample up into small time portions and then concatenate the results > into a time-based array? It is, though maybe not the best way. I decided not to say that, and leave it up to others to give more details. Actually, the DCT is better than the FFT for that, as the boundary conditions make more sense. DCT is commonly used for image compression, and you will still sometimes see artifacts in the decompressed image. Some of those come from the sharp boundaries of your sampling window. I would recommend reading the Wikipedia entry "Spectrum Analyzer", along with some of the referenced articles. -- glen
From: ajjc on 20 Jun 2010 13:14 On Jun 18, 2:43 pm, glen herrmannsfeldt <g...(a)ugcs.caltech.edu> wrote: > Raeldor <rael...(a)gmail.com> wrote: > > (snip on spectrum analyzers and FFT) > > > Thanks for the reply, Glen. Is it possible I can just break the > > sample up into small time portions and then concatenate the results > > into a time-based array? > > It is, though maybe not the best way. I decided not to > say that, and leave it up to others to give more details. > > Actually, the DCT is better than the FFT for that, as the > boundary conditions make more sense. DCT is commonly used > for image compression, and you will still sometimes see > artifacts in the decompressed image. Some of those come > from the sharp boundaries of your sampling window. > > I would recommend reading the Wikipedia entry "Spectrum > Analyzer", along with some of the referenced articles. > > -- glen Also, you might look at the Spectrum tools in the Open Source Audacity code.(e.g. see audacity/src/FFT.cpp ) http://audacity.sourceforge.net/ I believe that audacity handles .WAV files. They take...say...a series of overlapping samples of 512 points, by moving along in time, and then compute the spectrum using a real FFT and then line them up in vertical slices. So the x-axis is time and the y-axis is spectrum, colored by the magnitude of the bin. There is native FFT code and all sorts of other stuff...all in C++. The downside is that it takes a while to get a handle on it all. alan
|
Pages: 1 Prev: CIC filter response Next: dealing with aliasing |