We’re rewarding the question askers & reputations are being recalculated! Read more.
23

The two primary factors that describe a window function are: Width of the main lobe (i.e., at what frequency bin is the power half that of the maximum response) Attenuation of the side lobes (i.e., how far away down are the side lobes from the mainlobe). This tells you about the spectral leakage in the window. Another not so frequently considered factor is ...


15

How can I apply a window function like Hamming or Lanczos to a signal, using its coefficients? Just multiply, point-by-point.


12

Windowing is used because the DFT calculations operate on the infinite periodic extension of the input signal. Since many actual signals are either not periodic at all, or are sampled over an interval different from their actual period, this can produce false frequency components at the artificial 'edge' between repeated intervals, called leakage. By first ...


12

The FFT can only be performed over a limited chunk of data. The basic math is based on the assumption that the time domain signal is periodic, i.e. your chunk of data is repeated in time. That typically results in a major discontinuity at the edges of the chunk. Let's look at a quick example: FFT size = 1000 points, Sample Rate = 1000 Hz, Frequency ...


11

I think you are confusing two different operations. Windowing in the time domain is explained by @sam, so I won't repeat that. But windowing is not done to perform filtering. Filtering by multiplying the FFT of a signal by the filter frequency response is entirely reasonable in many situations, and is indeed done. The alternative for filtering is time-...


11

There have been several good answers to this question. However, I feel that one important point has not been made entirely clear. One part of the question was why we don't just multiply the FFT of a signal with the desired filter response. E.g., if we want to lowpass filter our signal, we could simply zero all frequency components higher than the desired cut-...


10

I presume you are correct in that the small difference in the original signal fft's is due to leakage. However, the huge difference in the windowed results arises because you simply do not have enough data. Your original signals only have data for one period of the sinusoid. When you window this, you are clamping the edges of your signal to zero, effectively ...


10

In reviewing fred harris Figures of Merit for various windows (Table 1 in this link) the Hamming is compared to the Hanning (Hann) at various values of $\alpha$ and from that it is clear that the Hanning would provide greater stopband rejection (The classic Hann is with $\alpha =2$ and from the table the side-lobe fall-off is -18 dB per octave). I provided ...


9

I'll use the shorthand window for "window function". With audio, any processing that creates something akin to pre-ringing or pre-echo will sound sloshy like a low bit-rate mp3. This happens when localized energy of a transient or an impulse is spread backwards in time, for example by modification of the spectral data in lapped transforms such as lapped ...


8

There's a large variety of windows compared in this seminal fred harris paper from 1978: "On the use of Windows for Harmonic Analysis with the Discrete Fourier Transform" Well worth a read!


8

This really depends on how fancy you want to get. A "good" analyzer will typically do the following things. Split the input into frames. The frames typically overlap and are windowed. Good choices are an overlap of 50% and a Hanning window. Do an FFT Select the center frequencies of bands. For audio good choices are octaves or third octaves (see http://www....


8

If done correctly, the order should not matter. You apply windowing to remove the jumps at the end of the signal segment by fading the values there to zero. Zero-padding then continues with zeros. Irregardless if padded or not, the windowing should only be applied to the original signal segment. The wrong way would be to zero-pad and then apply windowing to ...


8

Aside from reduction of spectral leakage, there is a one major trade-off to be made when choosing a window function. Below you can see a figure with various parameters. Two of them are most important: Main Lobe Width Peak Side Lobe Level Width of the main lobe affects resolution of your analysis. I am sure you know that multiplication in time domain is ...


8

The concept of spectral leakage is not dependent on the context, and it's the same thing for the DTFT as it is for the DFT. It's probably helpful to remember that the DFT of a finite length sequence equals a sampled version of the DTFT of the same sequence: $$\begin{align}X(\omega)&=\sum_{n=0}^{N-1}x[n]e^{-jn\omega}\qquad\text{(DTFT)}\\ \tilde{X}[k]&...


8

Parseval's theorem will hold, but take into account that your signal in the time domain will no longer be $x[n]$. Namely, if you have that $$\sum_{n=0}^{N-1} \Big| x[n] \Big|^2 = \frac{1}{N} \sum_{k=0}^{N-1} \Big| X[k] \Big|^2$$ then, if you window the signal $x[n]$ with a window $w[n]$, your signal will now be $\hat{x}[n]=x[n]w[n]$, and the theorem will ...


7

If you're concerned with doing spectral analysis on a signal with a large DC component, and you want to suppress that DC peak, then a window function is not what you want. As some other answers noted, a highpass filter (or, viewed differently, a notch filter with the notch at zero frequency) is an appropriate solution. To understand why, you need to think ...


7

Couple of things: With an FFT of 128 points your frequency resolution is 11.71 Hz, so you can't really directly look at 15 Hz. Your assertion that $fftsin(2)$ corresponds to 15 Hz is wrong. By doing an FFT of 128 points over a 100 time domain samples, you basically append 28 zeros to the waveform. That changes the spectrum significantly. The window is a ...


7

Windowing reduces spectral leakage. Say you start out with a $\sin(y) = \cos(\omega_0 t)$. The period is obviously $2 \pi/ \omega_0$. But if nobody told you that the period is $2 \pi/ \omega$ and you blindly choose the range $[0, 1.8 \pi/\omega_0]$ and take FFT of this truncated waveform, you will observe frequency components in other frequencies ...


7

Windowing is not a filter. Windowing is a multiplication of two signals in time (the input samples with the window function: $x_w[n] = x[n] \times w[n]$ ). What you get in the frequency domain is a (circular) convolution of the transforms of your signal and the window. This convolution in the frequency domain can be seen as the spectrum being low-pass-...


7

We always want to apply some kind of a window function in order to minimize the effect of leakage. This makes rectangular window (lack of any windowing) case never used, this is why: Any tapering function used is almost always decreasing to zero at boundaries. This is why we are losing some data. In order to retrieve that somehow you will usually do 50% of ...


7

The cross pattern is typically a border effect, due to the periodicity induced by the standard implementation and hypotheses behind the Fast Fourier transform, when the image lacks periodicity from the right to the left, and the bottom to the top. In other words: if two opposite borders lacks continuity in values (when glued together), artifacts show. The ...


7

Yes, it's possible to analyse sound the way ears do. For example, you could compute the DFT of a signal continuously using several Goertzel filters. $$ y_k[n] = e^{j2\pi k/N} y_k[n-1] + x[n] $$ where $k= 0,1,\ldots, N-1$, so that $y_0$ is the DC or zero frequency term. Of course, this is an unstable filter, so some resetting or forgetting factor is ...


7

Why is each window/frame overlapping? Windowing is a means to stationarize signals. Inside a small enough window, you can expect that the properties of the signal chunk do not vary too fast. And you now can use tools well-suited to stationary signals, like Fourier-based techniques. You can imagine non-overlapping rectangular windows, each defining a frame....


6

They do "distort" the signal, as you noted. Multiplying by a window function does not "retain" the spectrum of the original signal. Recall the multiplication property of the Fourier transform: $$ x(t) w(t) \Leftrightarrow X(\omega) * W(\omega) $$ where the $*$ denotes convolution. So, multiplying by a window function in the time domain yields convolution ...


6

Windowing in the time domain is a convolution in the frequency domain. A window function will thus, in the frequency domain, convolve a single spectral frequency point with a spreading function. For very low frequencies, this window spreading function can spread an FFT frequency bin and its corresponding negative frequency bin right across DC so that the 2 ...


6

If you don't use a non-rectangular window, then the FFT results will already be convolved with the transform of a default rectangular window (a periodic Sinc) before doing any frequency domain filtering. e.g. you will get two filters applied, one of which you probably don't want. By windowing in the time domain, before the FFT and frequency domain ...


6

Since the DFT is representable by multiplication with the Fourier matrix, your question is equivalent to asking what the eigenvectors of the Fourier matrix are. Actually, Wikipedia provides the answer (http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Eigenvalues_and_eigenvectors). However, since the eigenvalues ($1, -1, i, -i$) are not simple, the ...


6

zero-padding will not "improve resolution" in the sense that it would help you separate two peaks in the spectrum that are very close (too close) to each other. but zero-padding, as well as interpolation in the frequency domain, does improve resolution in the sense that it help you to more precisely estimate the location of an isolated peak in the spectrum. ...


6

Is this meant to happen? Yes, that is absolutely a well known effect of using any window function. Taking a look through the Wikipedia article on window functions, we find that the rectangular window has the sharpest peak. This is quite simply due to the fact that the rectangular window acquires the most data, meaning that it can distinguish between ...


Only top voted, non community-wiki answers of a minimum length are eligible