From: Michal Wallace (sabren_at_manifestation.com)
Date: 2002-06-15 23:21:13
On Sat, 15 Jun 2002, Jim Peters wrote:
> When you do an FFT of a block of sound, you can't just FFT it straight
> off. Well, you can, but you end up with lots of distortion because
> you have effectively cut a rectangle out of the sound, and there are
> big clicks at the start and end of it. (And when you give a chunk of
> sound to an FFT, it acts as if that sound chunk is looped forever, so
> you can imagine what kind of distortion that creates if you don't tidy
> up the edges).
Aha! I wondered why one of the samples came out clean and
the others didn't.. It's because that one, when looped, was
a continuous wave and the others had the edges cut
off. Thanks! :)
> So, if you want nice results from your FFT, you need to
> window the data first -- which means multiplying it by a
> 'window function', effectively flattening off the edges.
> Don't think you can choose just any old function, because
> each different shape has its own particular frequency
> response. There are several types of window, but I used
> the 'Blackman' window in my code.
Thanks. I'd seen the term window used in the various
articles I read, but I hadn't understood what it was for
until you just explained it.
I took a look at your code, and then through the docs for
Numpy, and found that it has an "MLab" (Matlab-compatible?)
module which generates it:
import MLab
window = MLab.blackman(length)
Then I can do "slice * window" in the loop and not have
to recalculate the window each time.
I tried it out, and it definitely cleans up the noise.
Thanks! :)
Cheers,
- Michal http://www.sabren.net/ sabren_at_manifestation.com
------------------------------------------------------------
Switch to Cornerhost! http://www.cornerhost.com/
High Powered Hosting - With a Human Touch. :)
------------------------------------------------------------
This archive was generated by hypermail 2.1.4 : 2002-07-27 12:28:43 BST