# Why does FFT generate a jaggedy signal

I have an application that fills a buffer from my computer's microphone and does an FFT. My objective is to figure out what frequencies are in the sample.

I've tested the application by whistling as well as by playing this video from my cellphone into my computer's mic (I've tried two different mics to be sure). What I expect (taking the absolute frequency) is a smooth Gaussian-like curve with a mean at the frequency of the incoming tone, but what I'm getting is this: What is the cause for the jaggedness of the signal's frequency spectrum? And what technique can be used to reliably identify the main frequencies present in the signal while filtering out the unwanted bumps?

• This is the windowing effect, causing spectral leakage. The longer your window (=buffer), the higher the spectral resolution. You can trade off resolution and spectral leakage by using different window functions. Right now you're effectively using a rectangular window because you just fill a buffer of finite length. – Matt L. Dec 14 '14 at 18:27

$$x(t)\star w(t) = X(f)\cdot W(f)$$
Where your signal $x(t)$ is a sinusoid with a spectrum being a Kronecker (Dirac) Delta function, $w(t)$ is a rectangular window function. In DFT by default we are using rectangular window (taking a time snippet of a signal). Please check out this paper for more info: A Comprehensive Window Tutorial
• @jojek, when you're writing $x(t)$ or $w(t)$, what first comes to mind is that you're in the continuous-time domain (sometimes "analog domain", for the anal-retentive like me, "analog" and "continuous-time" are not quite the same thing). also, i might suggest the circled asterisk $\circledast$ ("\circledast" in $\LaTeX$) for convolution. $\star$ is okay, i guess, but i thought it may have had other uses in mathematics. one thing, for sure, is we need to get away from $*$ because we use it for simple multiplication in any programming language i am familiar with (and i don't know very many). – robert bristow-johnson Dec 14 '14 at 21:25
• actually, @MattL., i think when you're in the discrete-whatever domain, the Kronecker delta appears about as commonly as does the Dirac delta in the continuous-whatever domain. just an opinion though. and we all know you're strictly correct about the Dirac delta not being a function (if $f(x)=g(x)$ almost everywhere, their integrals over the same range have to be equal and, if $\delta(t)$ were a "function", it and $g(t)=0$, would be equal almost everywhere, yet their integrals are different). i like to think of $\delta(t)$ having finite width of 1 Planck Time and make all that crap go away. – robert bristow-johnson Dec 14 '14 at 21:36