I am very new to DSP, so excuse my ignorance.

Using Audacity, I generated a sine wave of:

  • frequency 440Hz
  • amplitude: 0.8
  • duration: 1 minute

Now when i plot the spectrum for this sine wave, I get an image like this:

enter image description here

This is really surprising for me.

I was expecting a single surge at 440 Hz for the pure tone. But this is entirely different. Sure this is not anything to do with noise. Right ?

My question

How can the spectrum of a pure tone have so many frequency components in the spectrum.

What obvious am I missing ?

  • 2
    $\begingroup$ This is probably a duplicate of some question or other. In short: it's because the FFT only operates on a short segment of the wave, and it's being cut off at a length that is not a complete cycle. $\endgroup$ – endolith May 1 '14 at 23:29

An FFT only results in a single component (plus its complex conjugate and some tiny numerical noise) if the single pure real sinusoid input is of a frequency whose period is an exact integer submultiple of the FFT size. A rectangular window makes any "leakage" into other non-adjacent bins even worse.

But the length of the FFT you have specified is 512, which is not an exact multiple of the period of your signal (which is 44100/440 = 100.227273).

  • $\begingroup$ Just a suggestion to avoid cluttering this site with dozens of equivalent answers to this single most frequently recurring question: Wouldn't it be a good idea to vote for the clearest answer and always refer any new users back to this best answer instead of rephrasing it over and over again? $\endgroup$ – Matt L. May 2 '14 at 9:05

When you take the DFT of a finite length sequence, you are effectivly windowing it. For the simple example you described with a sinusoid, you are first taking y[n] = x[n] * w[n] where x is the sinusoid and w is the window function. Multiplication in the time domain is convolution in the frequency domain. The DFT of a rectangular window is a sinc function. See the fourier transform pair 201 in Wikipedia and it shows a rectangular function. The fourier transform of a sin function is two delta impulses at +/- frequency. You're only plotting the positive frequency, but the same exists in the negative frequency domain also.

When you convolve a sinc function with a delta function you smear the two, so that's why you have a sinc function that is smeared across the frequency domain.

There are other properties that characterize window functions like main lobe width and peak side lobe level, all of which are outside the scope of this question, but generally people use hamming or hanning windows prior to taking the FFT.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.