Sometimes I find the notation WFT (Windowed Fourier Transform) while other times I see STFT (Short Time Fourier Transform). Are they the same?
-
2$\begingroup$ sorta. gotta add some kinda hopping or sliding of the window, and then you have the STFT. $\endgroup$– robert bristow-johnsonDec 6, 2017 at 18:47
-
$\begingroup$ Can you expand a little on hopping and sliding? In a paper I'm reading they use the WFT to get the spectrogram by sliding and modulating a window. What would be the difference in the STFT? $\endgroup$– Diego SacconiDec 6, 2017 at 19:01
3 Answers
In Chapter 2.4 Previous Work of The Short Time Fourier Transform and Local Signals, S. Okamura, 2011, one reads:
The STFT is also known under many names such as the windowed Fourier Transform, the Gabor transform, and the local Fourier transform.
Later, one discovers that the definition may slightly vary with different authors, but, at first glance, they are the same. Be careful though. For some persons, a "Windowed Fourier Transform" is a mere Fourier transform of a windowed signal. Because there is no sliding nor shift involved. For some, "short" implies "finite support".
Leaving theses versions aside, my personal interpretation and use is that a “Windowed Fourier Transform” is a special case of a slightly more generic “STFT” acceptation, for two (mild) reasons:
- "windowed" somehow conveys the idea that only one window is used. But you can easily use different windows for STFT, long ones for low frequency, shorter ones for high frequencies.
- the concept behind "what a window is" is not evident. However, for most people, a window often has a non-zero sum (or unit), and often is either increasing/decreasing (unimodal, flat being a trivial version) or monotonic (like exponential window or weighting) for causal implementations. For short-term, it only needs to be "short", or well-concentrated in time, and could be more complicated.
-
1$\begingroup$ From what I've understood also the Gabor transform should be a special case of STFT with Gaussian window $\endgroup$ Dec 6, 2017 at 20:53
-
1$\begingroup$ Somehow, yes, since the Gaussian is one example of a single window. However, to pay more respect to the original Gabor paper (quite profound), I'd call it "THE prototype". $\endgroup$ Dec 6, 2017 at 21:00
This is just an attempt to state quantitatively what the STFT might be.
Current discrete time is $n$, hop is $H$, (non-zero) length of window, $w[n]$, and frame is $F$. Fraction of overlap is $\tfrac{F-H}{F}$ and $H \le F$.
The window $w[n]$ is defined in terms of the normalized-length prototype $w(t)$ as
$$ w[n] \triangleq w\left( \tfrac{n}{F} \right)$$
If we make
$$ \sum\limits_{m=-\infty}^{+\infty} w[n-mH] = 1 \qquad \forall \ n \in \mathbb{Z} $$
or
$$ \sum\limits_{m=-\infty}^{+\infty} w\left( \tfrac{n-mH}{F} \right) = 1 $$
then
$$\begin{align} x[n] &= x[n] \times 1 \\ &= x[n] \times \sum\limits_{m=-\infty}^{+\infty} w\left( \tfrac{n-mH}{F} \right) \\ &= \sum\limits_{m=-\infty}^{+\infty} x[n] w\left( \tfrac{n-mH}{F} \right) \\ &= \sum\limits_{m=-\infty}^{+\infty} x_m[n-mH] \\ \end{align}$$
where
$$\begin{align} x_m[n-mH] & \triangleq x[n] \, w\left( \tfrac{n-mH}{F} \right) \\ x_m[n] &= x[n+mH] \, w\left( \tfrac{n}{F} \right) \\ &= x[n+mH] \, w[n] \\ \end{align}$$
So $x_m[n]$ is a finite-length frame of audio of length $F$ and represents the audio in the neighborhood of $x[n+mH]$ or $m$ hops from the beginning.
The STFT would be (depending on whether you're a pencil or a computer) the DTFT or the DFT of $x_m[n]$.
STFT as DTFT: $$\begin{align} X_m(e^{j\omega}) &\triangleq \mathscr{F} \big\{ x_m[n] \big\} \\ &= \sum\limits_{n=-\infty}^{+\infty} x_m[n] e^{-j \omega n} \\ &= \sum\limits_{n=-\infty}^{+\infty} x[n+mH] w\left( \tfrac{n}{F} \right) e^{-j \omega n} \\ &= \sum\limits_{n=-\frac{F}2}^{\frac{F}2 - 1} x[n+mH] w\left( \tfrac{n}{F} \right) e^{-j \omega n} \\ \end{align}$$
STFT as DFT: $$\begin{align} X_m[k] &= \sum\limits_{n=-\frac{N}{2}}^{\frac{N}{2}-1} x_m[n] e^{-j 2 \pi nk/N} \\ \\ &= \sum\limits_{n=-\frac{N}{2}}^{\frac{N}{2}-1} x[n+mH] w\left( \tfrac{n}{F} \right) e^{-j 2 \pi nk/N} \\ \end{align}$$
I guess, for the DFT version, then $H \le F \le N$.
It should probably be made clear here that:
$$\begin{align} X(e^{j\omega}) &\triangleq \mathscr{F} \big\{ x[n] \big\} \\ &= \mathscr{F} \left\{ \sum\limits_{m=-\infty}^{+\infty} x_m[n-mH] \right\} \\ &= \sum\limits_{m=-\infty}^{+\infty} \mathscr{F} \big\{ x_m[n-mH] \big\} \\ &= \sum\limits_{m=-\infty}^{+\infty} \mathscr{F} \big\{ x_m[n] \big\} e^{-j \omega mH} \\ &= \sum\limits_{m=-\infty}^{+\infty} X_m(e^{j\omega}) e^{-j \omega mH} \\ \end{align}$$
Each input frame $x_m[n]$ gets processed into an output frame $y_m[n]$ and the output frames overlap-add to reconstruct the output in the same manner as the input is constructed.
$$ y[n] = \sum\limits_{m=-\infty}^{+\infty} y_m[n-mH] $$
So how do you make $ \sum\limits_{m=-\infty}^{+\infty} w\left( \tfrac{n-mH}{F} \right) = 1 $? This is what we call "complementary" windows.
Usually with 50% overlap, we mean that the sum of the falling half of the $m$th window adds to the rising half of the $(m+1)$th window and they add to 1. 50% overlap means $\tfrac{F-H}{F} = 0.5$ or $F = 2H$.
Then
$$ \sum\limits_{m=-\infty}^{+\infty} w\left( \tfrac{n-mH}{2H} \right) = 1 $$
Picking two neighboring windows ($m=0,1$) that overlap says
$$ w\left( \tfrac{n}{2H} \right) + w\left( \tfrac{n-H}{2H} \right) = 1 $$
for $0 \le n \le H$
Now you can do STFT with 75% overlap, $\tfrac{F-H}{F} = 0.75$, $F = 4H$, and there would be 4 terms that you would be adding together to get 1.
A complementary Hann window (at 50% overlap), centered about zero and having even length $F$ (the non-zero length is $F-1$), is
$$ w\left( \tfrac{n}{F} \right) = \begin{cases} \tfrac12 + \tfrac12 \cos\left( 2 \pi \tfrac{n}{F} \right) \qquad & |n| \le \frac{F}{2} \\ 0 \qquad & |n| \ge \frac{F}{2} \\ \end{cases} $$
For more general overlap it's scaled to be complementary as:
$$ w\left( \tfrac{n}{F} \right) = \begin{cases} \tfrac{H}{F} \left( 1 + \cos\left( 2 \pi \tfrac{n}{F} \right) \right) \qquad & |n| \le \frac{F}{2} \\ 0 \qquad & |n| \ge \frac{F}{2} \\ \end{cases} $$
-
2$\begingroup$ Is your point that the WFT consists of a single inner product between a signal and a window? According to this idea, the STFT would be a repeated application of the WFT with the appropriate sliding of the window. $\endgroup$ Dec 7, 2017 at 21:51
-
1$\begingroup$ the STFT are the Fourier Transforms (either DTFT or DFT) of multiple inner products of a sliding segment of signal (usually we call that sliding segment a "frame") and a window. so i think your characterization is correct. $\endgroup$ Dec 8, 2017 at 1:01
-
Answer: Not a synonym.
A periodigram uses windows but is not the STFT. Cross and Auto Correlation can also use windows.
Similar but Windowed FFT and STFT are not exchangeable terms