I know the size of DFT is the number of samples used to do the calculation. But the audio signal (and other signals) normally have many samples. So, what does really happen, if I choose $2$ seconds of audio, which will have $2 \times 44100$ samples, and $1024$ as the size of DFT ?

First, the result of the DFT is the amplitude and phase of the frequencies which are stepped by $44110 / 2 / (1024 / 2) \approx 43\textrm{Hz}$. So we get $0\textrm{Hz, } 43\textrm{Hz, } 86\textrm{Hz, } .... \textrm{to } 22050\textrm{Hz}$. Is this correct?

Second, as I analysis the $2$-second signal, the calculation is done by using every $1024$ samples to calculate $512$ DFT bins, then what ? We can get $44100 * 2 / 1024 = 86$ results of DFT, we calculate the mean of every result to build the final result ?


In order to understand the effect of DFT length $N$ on the computed spectrum samples, you shall be aware of two things:

1- The interrelation between theoretical DTFT and practical DFT.

2- The windowing effect on the analysed samples

For the first relation, consider a causal, discrete-time signal $x[n]$ of finite length $L$, whose DTFT, $X(e^{j\omega})$ is:

$$ X(e^{j\omega}) = \sum_{n=0}^{L-1} x[n] e^{-j\omega n}$$

This is mainly a theoretical tool, it's a complex valued continuous-frequency function which can not be represented in a digital computer system which can only work with sampled data of finite bit length.

In order to solve this issue, an alternative definition of Fourier transform for discrete time signals have been proposed and called as the DFT (discrete Fourier transform) $X[k]$ given as:

$$ X[k] = \sum_{n=0}^{N-1} x[n] e^{-j\frac{2\pi}{N} n k} ~~~,~~~ \text{for} ~~~ k=0,1,...,N-1$$

Where $N$ is the DFT-size and not necessaily the signal length (usually $N \geq L$ is taken). When $N=L$ it can be seen from visual inspection that:

$$ X[k] = X(e^{j \omega})|_{w = \frac{2\pi}{N} k} = X(e^{-j\frac{2\pi}{N} k})$$

That's to say, N-point DFT values $X[k]$ of finite length signal $x[n]$ are the uniform samples of the DTFT $X(e^{j\omega})$ of the signal $x[n]$ itself. Hence we maintain the view that DFT values are the samples of the DTFT evaluated at $w_k = \frac{2\pi}{N} k$ frequencies.

Now it's obvious that the more samples you evaluate (larger the $N$) on DTFT $X(e^{j\omega})$ the smoother representation $X[k]$ will have. In addition, the minimum number of DFT samples that could exactly represent DTFT is given by $N_{min} = L$. Furthermore at this point it's very critical to understand the fact that increasing $N$ alone and keeping $L$ fixed, does not provide a higher-resolution spectrum samples, it merely provides a smoother set of finely spaced samples of fixed DTFT.

The second relation is what gives the clues of expected spectral resolution of the DFT samples. Now from multiplication by a window, $w[n]$ of length $M$, property of the DTFT, it can be seen that a finite-length excerpt $v[n] = w[n] x[n]$ from a signal $x[n]$ of indefinite (or very long) length is providing you the DTFT spectrum of a limited-resolution version of the true spectrum $X(e^{j\omega})$ which is based on all the samples of $x[n]$

The limitation of the spectrum is fundamentally determined by the window length $M$ and window type. So in a practical setting, your FFT block length (or input buffer length etc) gives you the windowing effect. The effect can be roughly summarized as a blurring of the true spectrum. The result of which is that close-by (and detailed) frequency content is mixed up and get lost in each other, so that you cannot recover them back.

So if you want highly detailed spectral examination of a signal, you should observe it long enough (your window length should be long) and you should use a long enough DFT size $N$ so that you get a dense sample representation of the true (blurred) spectrum $X(e^{j\omega})$ after it was windowed in time domain whose effect is a convolution with a low-pass character frequency function $W(e^{j\omega})$ resulting in a smeared true spectrum.

Then coming to your practical setting: when you have a signal of $x[n]$ sampled at $F_s = 44.1$ kHz, and rectangularly windowed by $M=1024$ samples, the computed DFT samples are providing the values of blurred spectrum whose rought frequency reolution is about $2 F_s /1024 \approx 86.1$ Hz. Using a Hamming window would instead provide a resolution of 160 Hz. And you should expect a resolution something in between. Therefore, eventhough the DFT bins would sample the windowed DTFT at spacing of $f_k = F_s/N = 43$ Hz apart, you cannot expect meaningful information at less than $86$ Hz steps at best and $160$ Hz steps most usually.

  • $\begingroup$ Thanks for your answer. DTFT, is for aperiodic discrete signal; DFT, is for periodic discrete signal; $\endgroup$
    – zxhfirefox
    Aug 9 '17 at 3:49
  • $\begingroup$ After reading and digesting, I think you are saying that because the computer can not process aperiodic discrete signal, so we use a window function to make the signal into segments, and process them separately, and the result spectrum is a roughly simulated version of the true spectrum, correct ? $\endgroup$
    – zxhfirefox
    Aug 9 '17 at 4:08
  • $\begingroup$ And for my second question, I read it in a book, and I think the answer is YES, the results are averaged to make a plot. $\endgroup$
    – zxhfirefox
    Aug 9 '17 at 4:08
  • $\begingroup$ To make more resolution in the spectrum, we should both provide longer samples and good size of DFT, correct? $\endgroup$
    – zxhfirefox
    Aug 9 '17 at 4:12
  • $\begingroup$ And the values of the result spectrum's x axis are stepped at 43Hz, but the meaningful step should be 86Hz, correct ? $\endgroup$
    – zxhfirefox
    Aug 9 '17 at 4:12

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.