On 9/4/06, Kevin McCoy km.takewithyou@gmail.com wrote:
Has anyone made an example patch that explains this? Something like a simple FFT filter with switchable windows, so you can hear the difference?
Actually anything (links, explanations, etc) that explains or details FFT as it relates to Pd would be great... the example patches are a bit cryptic, or sometimes jump a bit too quickly, at least for me. I want to eventually generate visuals based on obtaining frequency data from sound, but I just couldn't get my mind around fft~, rfft~ etc. so I am going cheap using bandpass filters now which is not really what I wanted. (Sidenote - does anyone know how other artists are accomplishing this? I assumed they were using FFT)
I know this is a fairly advanced topic but I'd really love to figure out how to make it work.
The explanation that did it best for me is in R.W. Hamming's 'Digital Filters', a pretty dense book (not for beginners like me, but cross referencing this book with Miller Puckette's- http://www-crca.ucsd.edu/~msp/techniques.htm - helped me make sense of some of it). Hamming explains that, if you take any two harmonically related sines or cosines, or one of each, or one of them and a zero-frequency component, then multiply the two functions over a full period, it will integrate to zero; meaning that the sums of all the positive values minus the sums of the negative values is zero. His explanation is more accurate, but confusing nonetheless. The only time the result isn't zero is if you are multiplying a sine or cosine or a zero-frequency part by itself at the same frequency.
This means that, since any function is theoretically the sum of an infinite number of sines and cosines, if you multiply either a sine or a cosine of a certain frequency by any function, the integral of the result will be exactly zero for every harmonically related frequency except the one you multiplied by, so the integral of this product tells you how strong the particular sine or cosine is in the total.
I'm probably leaving out a lot, and I might be downright wrong about something. But having some sort of intuitive understanding seems to be the only way I can use any tool without feeling like it's magic.
If you did a FFT with a block size larger than an entire audio file, as I understand it, you wouldn't need a window. Looping Martin Luther King's "I Have a Dream" speech (or the audio from the second season of CHIPS, or a recording of penguins in their natural habitat) over and over with a 30-minute pause between each round would technically be a "periodic function", so analyzing it this way would create an accurate representation; unfortunately, you would have exactly one value for each frequency, which tells you nothing about the frequency content at any point. To analyze changing frequency content, you have to take smaller blocks. Repeating these to make them "periodic functions" means the beginning and end of any one block of sound will run together. If this happens to create a continuous function, great, but the chances of that happening with every block are pretty low (if a block is 64 samples, at 44100 samples per second, and the second season of CHIPS is 23 episodes, that's a lot of blocks). Windowing the input simply forces that part of the function to be continuous, by forcing beginning and end to the same value and direction. To prevent the data from that part of the function from being completely lost, alternating FFTs can be taken with windows in opposite phase.
I don't exactly understand what happens with the result, though. Whether the frequency values are averaged, or whether resynthesis is done with the same overlapping. I also don't understand upsampling/downsampling with the block~ object, but I'm not sure that's related.
-Chuckk
Glad this came up!! Kevin
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list