Lesson
The theory — Discrete Fourier Transform
The discrete Fourier transform of N samples x0 … xN−1 is N numbers Xk = Σn xn e−2πikn/N, one per bin k, each measuring how much of a wave completing k cycles in the N samples the signal holds. It treats the samples as one period of a signal that repeats, so it is exact for tones that complete whole cycles and spreads every other tone across the bins: spectral leakage. A window wn multiplies the samples first to soften the seam.
What each symbol means
A_k- the amplitude bin k implies, what the bars show: 2|Xk|/(N·G) for 0 < k < N/2, and |Xk|/(N·G) at k = 0 and k = N/2, which have no mirror bin to share with. A tone of amplitude 1 on a bin reads 1
G- the window's coherent gain, the mean of wn: 1 with no window, ½ for Hann
- Assumes
- Each tone starts at its peak, as a cosine. The far-skirt figures move with the starting phase: bin 31 of the 10.5-cycle tone is 26.3 dB below the tallest bar for a cosine and 31.2 dB below for a sine, while the 81% in the two nearest bins hardly moves. The Hann window is the periodic form, ½ − ½cos(2πn/N), whose transform is exactly three bins.
Problem solved in full
-
Correct a reading, then remove the need to 4 steps
An analyser samples 8,000 times a second and transforms 64 samples at a time, with no window. You feed it a 1,312.5 Hz test tone and the tallest bar reads 0.32. What is the tone's true amplitude, and how many samples per block would put the tone exactly on a bin? Press The arrows bend: the page plays a tone at that frequency.
-
Bins are 8,000/64 apart, so the tone completes 10.5 cycles per block: halfway between bins 10 and 11.
-
Halfway, the page's tallest bar reads 64.61% of the tone. Divide it out:
-
The tone lands on a bin when a block holds a whole number of its cycles. With 128 samples the bins are 62.5 Hz apart:
-
Had the analyser used a Hann window on the 64 samples, the tallest bar would have read 84.89% of the tone, so the same tone would show:
Answer
About 0.495, and 128 samples a block. Any multiple of 128 also works, since 1,312.5 Hz needs 128 samples to complete a whole number of cycles (21). The page is fixed at 64, so the 128-sample case is past what it can show; at 128 the bar reads the full 0.495, and the window would no longer be needed to read the amplitude, only to keep a strong tone's skirt off a faint one.
-
Learning path
The Fourier transform in practice
References (2)
- The standard reference on windows. Leakage defined as the page shows it: of all frequencies “only those which coincide with the basis will project onto a single basis vector; all other frequencies will exhibit non zero projections on the entire basis set”, because “the periodic extension of a signal not commensurate with its natural period exhibits discontinuities at the boundaries of the observation” (p. 52). Table I (p. 55) gives coherent gain 1.00 and 0.50 and scalloping loss 3.92 dB and 1.42 dB for the rectangle and Hann windows: F. J. Harris, “On the use of windows for harmonic analysis with the discrete Fourier transform”, Proceedings of the IEEE, vol. 66, no. 1, pp. 51–83 (1978).
- The DFT's definition, and what happens to a frequency that is not a bin: the sum “is N if ωₖ = ωₓ and zero at ωₗ, for l ≠ k. However, the sum is nonzero at all other frequencies”: J. O. Smith III, Mathematics of the Discrete Fourier Transform (DFT), with Audio Applications, 2nd ed., W3K Publishing (2007), “DFT Definition” and “Frequencies in the ‘Cracks’”.